Iostream streambuf for a socket. More...
#include <basic_socket_streambuf.hpp>
Public Types | |
typedef Protocol::endpoint | endpoint_type |
The endpoint type. | |
Public Member Functions | |
basic_socket_streambuf () | |
Construct a basic_socket_streambuf without establishing a connection. | |
BOOST_PP_REPEAT_FROM_TO (1, BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY), ASIO_PRIVATE_CONNECT_DEF, _) basic_socket_streambuf< Protocol | |
Close the connection. | |
StreamSocketService * | close () |
Close the socket. | |
basic_socket_streambuf < Protocol, StreamSocketService > * | connect (const endpoint_type &endpoint) |
Establish a connection. | |
virtual | ~basic_socket_streambuf () |
Destructor flushes buffered data. | |
Protected Member Functions | |
int_type | overflow (int_type c) |
std::streambuf * | setbuf (char_type *s, std::streamsize n) |
int | sync () |
int_type | underflow () |
Private Types | |
enum | { putback_max = 8 } |
enum | { buffer_size = 512 } |
Private Member Functions | |
void | init_buffers () |
void | resolve_and_connect (const typename Protocol::resolver_query &query, asio::error_code &ec) |
Private Attributes | |
boost::array< char, buffer_size > | get_buffer_ |
boost::array< char, buffer_size > | put_buffer_ |
bool | unbuffered_ |
Iostream streambuf for a socket.
Definition at line 74 of file basic_socket_streambuf.hpp.
typedef Protocol::endpoint asio::basic_socket_streambuf< Protocol, StreamSocketService >::endpoint_type |
The endpoint type.
Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.
Definition at line 81 of file basic_socket_streambuf.hpp.
anonymous enum [private] |
Definition at line 271 of file basic_socket_streambuf.hpp.
anonymous enum [private] |
Definition at line 272 of file basic_socket_streambuf.hpp.
asio::basic_socket_streambuf< Protocol, StreamSocketService >::basic_socket_streambuf | ( | ) | [inline] |
Construct a basic_socket_streambuf without establishing a connection.
Definition at line 84 of file basic_socket_streambuf.hpp.
virtual asio::basic_socket_streambuf< Protocol, StreamSocketService >::~basic_socket_streambuf | ( | ) | [inline, virtual] |
Destructor flushes buffered data.
Definition at line 93 of file basic_socket_streambuf.hpp.
asio::basic_socket_streambuf< Protocol, StreamSocketService >::BOOST_PP_REPEAT_FROM_TO | ( | 1 | , |
BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY) | , | ||
ASIO_PRIVATE_CONNECT_DEF | , | ||
_ | |||
) |
Close the connection.
this
if a connection was successfully established, a null pointer otherwise. StreamSocketService* asio::basic_socket_streambuf< Protocol, StreamSocketService >::close | ( | ) | [inline] |
Close the socket.
This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the asio::error::operation_aborted error.
asio::system_error | Thrown on failure. |
Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.
Definition at line 140 of file basic_socket_streambuf.hpp.
basic_socket_streambuf<Protocol, StreamSocketService>* asio::basic_socket_streambuf< Protocol, StreamSocketService >::connect | ( | const endpoint_type & | endpoint | ) | [inline] |
Establish a connection.
This function establishes a connection to the specified endpoint.
this
if a connection was successfully established, a null pointer otherwise. Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.
Definition at line 106 of file basic_socket_streambuf.hpp.
void asio::basic_socket_streambuf< Protocol, StreamSocketService >::init_buffers | ( | ) | [inline, private] |
Definition at line 239 of file basic_socket_streambuf.hpp.
int_type asio::basic_socket_streambuf< Protocol, StreamSocketService >::overflow | ( | int_type | c | ) | [inline, protected] |
Definition at line 172 of file basic_socket_streambuf.hpp.
void asio::basic_socket_streambuf< Protocol, StreamSocketService >::resolve_and_connect | ( | const typename Protocol::resolver_query & | query, |
asio::error_code & | ec | ||
) | [inline, private] |
Definition at line 250 of file basic_socket_streambuf.hpp.
std::streambuf* asio::basic_socket_streambuf< Protocol, StreamSocketService >::setbuf | ( | char_type * | s, |
std::streamsize | n | ||
) | [inline, protected] |
Definition at line 226 of file basic_socket_streambuf.hpp.
int asio::basic_socket_streambuf< Protocol, StreamSocketService >::sync | ( | ) | [inline, protected] |
Definition at line 221 of file basic_socket_streambuf.hpp.
int_type asio::basic_socket_streambuf< Protocol, StreamSocketService >::underflow | ( | ) | [inline, protected] |
Definition at line 151 of file basic_socket_streambuf.hpp.
boost::array<char, buffer_size> asio::basic_socket_streambuf< Protocol, StreamSocketService >::get_buffer_ [private] |
Definition at line 273 of file basic_socket_streambuf.hpp.
boost::array<char, buffer_size> asio::basic_socket_streambuf< Protocol, StreamSocketService >::put_buffer_ [private] |
Definition at line 274 of file basic_socket_streambuf.hpp.
bool asio::basic_socket_streambuf< Protocol, StreamSocketService >::unbuffered_ [private] |
Definition at line 275 of file basic_socket_streambuf.hpp.