31 #ifndef __CLAW_BASIC_SOCKETBUF_HPP__
32 #define __CLAW_BASIC_SOCKETBUF_HPP__
47 template<
typename CharT,
typename Traits >
49 public std::basic_streambuf<CharT, Traits>
59 typedef typename traits_type::int_type
int_type;
62 typedef typename traits_type::pos_type
pos_type;
65 typedef typename traits_type::off_type
off_type;
88 bool connect(
const std::string& addr,
int port );
90 void create_buffers();
91 void destroy_buffers();
93 bool buffered()
const;
104 size_t m_input_buffer_size;
110 size_t m_output_buffer_size;
113 static const size_t s_buffer_size;
121 #endif // __CLAW_BASIC_SOCKETBUF_HPP__
basic_socket * open()
Open the socket.
traits_type::off_type off_type
The type used to represent a delta in the positions.
virtual int_type overflow(int_type c=traits_type::eof())
Synchronize the output buffer (ie. write in the socket).
traits_type::int_type int_type
The type used to represent integers.
traits_type::pos_type pos_type
The type used to represent a position in the stream.
Common interface for claw::net::basic_socketbuf and claw::net::socket_server.
virtual int_type underflow()
Fill the input buffer.
CharT char_type
The type of the characters in the stream.
int descriptor
Type of the system description of the socket.
bool is_open() const
Tell if the socket is open.
basic_socketbuf< char_type, traits_type > self_type
The type of this implementation.
self_type * close()
Close the socket.
virtual int sync()
Write the buffered data in the socket.
Common interface for claw::net::basic_socketbuf and claw::net::socket_server.
Implantation of the claw::net::basic_socketbuf class.
basic_socketbuf(int read_limit=-1)
Constructor.
Socket buffer to be used with std::basic_stream, for easy socket reading and writing.
void set_read_time_limit(int read_limit)
Set the number of second to wait before considering nothing will come in the socket.
Traits traits_type
The traits carry some informations about the char_type.
virtual ~basic_socketbuf()
Destructor.