xtd 0.2.0
network_stream.h
Go to the documentation of this file.
1 #pragma once
5 #include "socket.h"
6 #include <iostream>
7 
9 namespace xtd {
11  namespace net {
13  namespace sockets {
35  class core_export_ network_stream : public std::iostream {
36  class socket_streambuf : public std::streambuf {
37  public:
38  socket_streambuf(const xtd::net::sockets::socket& socket, bool owns_socket);
39  ~socket_streambuf();
40 
41  int32 underflow() override;
42  int32 overflow(int32 value) override;
43 
45  bool owns_socket_ = false;
46  char value_ = EOF;
47  };
48 
49  public:
51 
57 
62  network_stream(const xtd::net::sockets::socket& socket, bool owns_socket);
64 
66 
73  virtual bool data_available() const;
74 
80 
81  private:
82  socket_streambuf stream_buf_;
83  };
84  }
85  }
86 }
Implements the Berkeley sockets interface.
Definition: socket.h:71
Provides the underlying stream of data for network access.
Definition: network_stream.h:35
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.
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Contains xtd::net::sockets::socket class.