asio 0.1.5 Main Page | Class Index | Member Index | Tutorial

buffered_recv_stream Class Template Reference

The buffered_recv_stream class template can be used to add buffering to the recv-related operations of a stream. More...

Inheritance diagram for buffered_recv_stream:

Inheritance graph
List of all members.

Public Types

typedef boost::remove_reference<
Next_Layer >::type 
next_layer_type
 The type of the next layer.

typedef next_layer_type::lowest_layer_type lowest_layer_type
 The type of the lowest layer.

typedef next_layer_type::demuxer_type demuxer_type
 The demuxer type for this asynchronous type.

typedef Buffer buffer_type
 The buffer type for this buffering layer.


Public Member Functions

template<typename Arg>  buffered_recv_stream (Arg &a)
 Construct, passing the specified demuxer to initialise the next layer.

next_layer_typenext_layer ()
 Get a reference to the next layer.

lowest_layer_typelowest_layer ()
 Get a reference to the lowest layer.

demuxer_typedemuxer ()
 Get the demuxer associated with the asynchronous object.

buffer_typerecv_buffer ()
 Get the recv buffer used by this buffering layer.

void close ()
 Close the stream.

size_t send (const void *data, size_t length)
 Send the given data to the peer. Returns the number of bytes sent or 0 if the stream was closed cleanly. Throws an exception on failure.

template<typename Error_Handler> size_t send (const void *data, size_t length, Error_Handler error_handler)
 Send the given data to the peer. Returns the number of bytes sent or 0 if the stream was closed cleanly.

template<typename Handler> void async_send (const void *data, size_t length, Handler handler)
 Start an asynchronous send. The data being sent must be valid for the lifetime of the asynchronous operation.

template<typename Handler, typename Completion_Context> void async_send (const void *data, size_t length, Handler handler, Completion_Context context)
 Start an asynchronous send. The data being sent must be valid for the lifetime of the asynchronous operation.

size_t fill ()
 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if the underlying connection was closed. Throws an exception on failure.

template<typename Error_Handler> size_t fill (Error_Handler error_handler)
 Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if the underlying connection was closed.

template<typename Handler> void async_fill (Handler handler)
 Start an asynchronous fill.

template<typename Handler, typename Completion_Context> void async_fill (Handler handler, Completion_Context context)
 Start an asynchronous fill.

size_t recv (void *data, size_t max_length)
 Receive some data from the peer. Returns the number of bytes received or 0 if the stream was closed cleanly. Throws an exception on failure.

template<typename Error_Handler> size_t recv (void *data, size_t max_length, Error_Handler error_handler)
 Receive some data from the peer. Returns the number of bytes received or 0 if the stream was closed cleanly.

template<typename Handler> void async_recv (void *data, size_t max_length, Handler handler)
 Start an asynchronous receive. The buffer for the data being received must be valid for the lifetime of the asynchronous operation.

template<typename Handler, typename Completion_Context> void async_recv (void *data, size_t max_length, Handler handler, Completion_Context context)
 Start an asynchronous receive. The buffer for the data being received must be valid for the lifetime of the asynchronous operation.


Private Member Functions

size_t copy (void *data, size_t max_length)
 Copy data out of the internal buffer to the specified target buffer. Returns the number of bytes copied.


Private Attributes

Next_Layer next_layer_
 The next layer.


Detailed Description

template<typename Next_Layer, typename Buffer = fixed_buffer<8192>>
class asio::buffered_recv_stream< Next_Layer, Buffer >

The buffered_recv_stream class template can be used to add buffering to the recv-related operations of a stream.


Member Typedef Documentation

typedef boost::remove_reference<Next_Layer>::type next_layer_type
 

The type of the next layer.

typedef next_layer_type::lowest_layer_type lowest_layer_type
 

The type of the lowest layer.

typedef next_layer_type::demuxer_type demuxer_type
 

The demuxer type for this asynchronous type.

typedef Buffer buffer_type
 

The buffer type for this buffering layer.


Constructor & Destructor Documentation

buffered_recv_stream Arg &  a  )  [explicit]
 

Construct, passing the specified demuxer to initialise the next layer.


Member Function Documentation

next_layer_type& next_layer  ) 
 

Get a reference to the next layer.

lowest_layer_type& lowest_layer  ) 
 

Get a reference to the lowest layer.

demuxer_type& demuxer  ) 
 

Get the demuxer associated with the asynchronous object.

buffer_type& recv_buffer  ) 
 

Get the recv buffer used by this buffering layer.

void close  ) 
 

Close the stream.

size_t send const void *  data,
size_t  length
 

Send the given data to the peer. Returns the number of bytes sent or 0 if the stream was closed cleanly. Throws an exception on failure.

size_t send const void *  data,
size_t  length,
Error_Handler  error_handler
 

Send the given data to the peer. Returns the number of bytes sent or 0 if the stream was closed cleanly.

void async_send const void *  data,
size_t  length,
Handler  handler
 

Start an asynchronous send. The data being sent must be valid for the lifetime of the asynchronous operation.

void async_send const void *  data,
size_t  length,
Handler  handler,
Completion_Context  context
 

Start an asynchronous send. The data being sent must be valid for the lifetime of the asynchronous operation.

size_t fill  ) 
 

Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if the underlying connection was closed. Throws an exception on failure.

size_t fill Error_Handler  error_handler  ) 
 

Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if the underlying connection was closed.

void async_fill Handler  handler  ) 
 

Start an asynchronous fill.

void async_fill Handler  handler,
Completion_Context  context
 

Start an asynchronous fill.

size_t recv void *  data,
size_t  max_length
 

Receive some data from the peer. Returns the number of bytes received or 0 if the stream was closed cleanly. Throws an exception on failure.

size_t recv void *  data,
size_t  max_length,
Error_Handler  error_handler
 

Receive some data from the peer. Returns the number of bytes received or 0 if the stream was closed cleanly.

void async_recv void *  data,
size_t  max_length,
Handler  handler
 

Start an asynchronous receive. The buffer for the data being received must be valid for the lifetime of the asynchronous operation.

void async_recv void *  data,
size_t  max_length,
Handler  handler,
Completion_Context  context
 

Start an asynchronous receive. The buffer for the data being received must be valid for the lifetime of the asynchronous operation.

size_t copy void *  data,
size_t  max_length
[private]
 

Copy data out of the internal buffer to the specified target buffer. Returns the number of bytes copied.


Member Data Documentation

Next_Layer next_layer_ [private]
 

The next layer.