asio::basic_socket_streambuf< Protocol, StreamSocketService > Class Template Reference

Iostream streambuf for a socket. More...

#include <basic_socket_streambuf.hpp>

Inheritance diagram for asio::basic_socket_streambuf< Protocol, StreamSocketService >:

asio::basic_socket< Protocol, StreamSocketService > asio::basic_io_object< StreamSocketService > asio::socket_base

List of all members.

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.
virtual ~basic_socket_streambuf ()
 Destructor flushes buffered data.
basic_socket_streambuf
< Protocol,
StreamSocketService > * 
connect (const endpoint_type &endpoint)
 Establish 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.

Protected Member Functions

int_type underflow ()
int_type overflow (int_type c)
int sync ()
std::streambuf * setbuf (char_type *s, std::streamsize n)

Private Types

enum  { putback_max = 8 }
enum  { buffer_size = 512 }

Private Member Functions

void init_buffers ()
template<typename ResolverQuery>
void resolve_and_connect (const ResolverQuery &query, asio::error_code &ec)

Private Attributes

boost::array< char, buffer_size > get_buffer_
boost::array< char, buffer_size > put_buffer_
bool unbuffered_


Detailed Description

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
class asio::basic_socket_streambuf< Protocol, StreamSocketService >

Iostream streambuf for a socket.

Member Typedef Documentation

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
typedef Protocol::endpoint asio::basic_socket_streambuf< Protocol, StreamSocketService >::endpoint_type

The endpoint type.

Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.


Member Enumeration Documentation

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
anonymous enum [private]

Enumerator:
putback_max 

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
anonymous enum [private]

Enumerator:
buffer_size 


Constructor & Destructor Documentation

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
asio::basic_socket_streambuf< Protocol, StreamSocketService >::basic_socket_streambuf (  )  [inline]

Construct a basic_socket_streambuf without establishing a connection.

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
virtual asio::basic_socket_streambuf< Protocol, StreamSocketService >::~basic_socket_streambuf (  )  [inline, virtual]

Destructor flushes buffered data.


Member Function Documentation

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
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.

Returns:
this if a connection was successfully established, a null pointer otherwise.

Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
asio::basic_socket_streambuf< Protocol, StreamSocketService >::BOOST_PP_REPEAT_FROM_TO ( ,
BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY)  ,
ASIO_PRIVATE_CONNECT_DEF  ,
 
)

Close the connection.

Returns:
this if a connection was successfully established, a null pointer otherwise.

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
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.

Exceptions:
asio::system_error Thrown on failure.
Note:
For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.

Reimplemented from asio::basic_socket< Protocol, StreamSocketService >.

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
int_type asio::basic_socket_streambuf< Protocol, StreamSocketService >::underflow (  )  [inline, protected]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
int_type asio::basic_socket_streambuf< Protocol, StreamSocketService >::overflow ( int_type  c  )  [inline, protected]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
int asio::basic_socket_streambuf< Protocol, StreamSocketService >::sync (  )  [inline, protected]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
std::streambuf* asio::basic_socket_streambuf< Protocol, StreamSocketService >::setbuf ( char_type *  s,
std::streamsize  n 
) [inline, protected]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
void asio::basic_socket_streambuf< Protocol, StreamSocketService >::init_buffers (  )  [inline, private]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
template<typename ResolverQuery>
void asio::basic_socket_streambuf< Protocol, StreamSocketService >::resolve_and_connect ( const ResolverQuery &  query,
asio::error_code ec 
) [inline, private]


Member Data Documentation

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
boost::array<char, buffer_size> asio::basic_socket_streambuf< Protocol, StreamSocketService >::get_buffer_ [private]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
boost::array<char, buffer_size> asio::basic_socket_streambuf< Protocol, StreamSocketService >::put_buffer_ [private]

template<typename Protocol, typename StreamSocketService = stream_socket_service<Protocol>>
bool asio::basic_socket_streambuf< Protocol, StreamSocketService >::unbuffered_ [private]


The documentation for this class was generated from the following file:
Generated on Fri Jul 30 03:00:08 2010 for rphp by  doxygen 1.5.4