xtd - Reference Guide 0.2.0
network_stream.h
Go to the documentation of this file.
1 #pragma once
5 
6 #include <iostream>
7 #include "socket.h"
8 
10 namespace xtd {
12  namespace net {
14  namespace sockets {
34  class core_export_ network_stream : public std::iostream {
35  class socket_streambuf : public std::streambuf {
36  public:
37  socket_streambuf(const xtd::net::sockets::socket& socket, bool owns_socket);
38  ~socket_streambuf();
39 
40  int underflow() override;
41  int overflow(int value) override;
42 
44  bool owns_socket_ = false;
45  char value_ = EOF;
46  };
47 
48  public:
50 
56 
61  network_stream(const xtd::net::sockets::socket& socket, bool owns_socket);
63 
65 
72  virtual bool data_available() const;
73 
79 
80  private:
81  socket_streambuf stream_buf_;
82  };
83  }
84  }
85 }
Implements the Berkeley sockets interface.
Definition: socket.h:68
Provides the underlying stream of data for network access.
Definition: network_stream.h:34
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Socket options apply to all sockets.
Contains xtd::net::sockets::socket class.