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

asio Namespace Reference

The asio namespace defines all user-accessible classes and templates. More...


Classes

class  basic_demuxer
 The basic_demuxer class template provides the core event demultiplexing functionality for users of the asynchronous I/O objects, such as stream_socket, and also to developers of custom asynchronous services. Most applications will use the demuxer typedef. More...

class  basic_dgram_socket
 The basic_dgram_socket class template provides asynchronous and blocking datagram-oriented socket functionality. Most applications will use the dgram_socket typedef. More...

class  basic_socket_acceptor
 The basic_socket_acceptor class template is used for accepting new socket connections. Most applications would use the socket_acceptor typedef. More...

class  basic_socket_connector
 The basic_socket_connector class template is used to connect a socket to a remote endpoint. Most applications will use the socket_connector typedef. More...

class  basic_stream_socket
 The basic_stream_socket class template provides asynchronous and blocking stream-oriented socket functionality. Most applications will use the stream_socket typedef. More...

class  basic_timer
 The basic_timer class template provides asynchronous timer functionality. Most applications will use the timer typedef. More...

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

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

class  buffered_stream
 The buffered_stream class template can be used to add buffering to both the send- and recv- related operations of a stream. More...

class  counting_completion_context
 The counting_completion_context class is a concrete implementation of the Completion_Context concept. It allows a limitation on the number of concurrent upcalls to completion handlers that may be associated with the context. Copies of an instance of this class represent the same context as the original. More...

class  error_t
 This class is used to indicate a placeholder for the actual error value. More...

class  expression
 The expression class template is used to allow expressions in an error handler template to be distinguished for the purposes of overloading the || and && operators. More...

class  value_eq_error
 Class template to compare the error for equality with a given value. More...

class  value_neq_error
 Class template to compare the error for inequality with a given value. More...

class  expr_or_expr
 Class template to perform logical or on two expressions. More...

class  expr_and_expr
 Class template to perform logical and on two expressions. More...

class  throw_error_t
 Class to always throw an error. More...

class  throw_error_if_t
 Class template to throw an error if an expression is true. More...

class  set_error_t
 Class template to always set a variable to the error. More...

class  set_error_if_t
 Class template to set a variable to the error if an expression is true. More...

class  log_error_t
 Class template to always log an error to a stream. More...

class  log_error_if_t
 Class template to log an error to a stream if an expression is true. More...

class  default_error_handler
 The default error handler. Always throws the error as an exception. More...

class  fixed_buffer
 The fixed_buffer class template can be used as a byte buffer. More...

class  null_completion_context
 The null_completion_context class is a concrete implementation of the Completion_Context concept. It does not place any limits on the number of concurrent upcalls to completion handlers that may be associated with the context. All instances of this class are equivalent. More...

class  service_factory
 This class may be specialised to provide custom service creation. More...

class  socket_error
 The socket_error class is used to encapsulate socket error codes. More...

class  timer_base
 The timer_base class is used as a base for the basic_timer class template so that we have a common place to define the from_type enum. More...


Typedefs

typedef basic_demuxer< implementation_defined > demuxer
 Typedef for typical usage of demuxer.

typedef basic_dgram_socket<
implementation_defined > 
dgram_socket
 Typedef for the typical usage of dgram_socket.

typedef basic_socket_acceptor<
implementation_defined > 
socket_acceptor
 Typedef for the typical usage of socket_acceptor.

typedef basic_socket_connector<
implementation_defined > 
socket_connector
 Typedef for the typical usage of socket_connector.

typedef basic_stream_socket<
implementation_defined > 
stream_socket
 Typedef for the typical usage of stream_socket.

typedef basic_timer< implementation_defined > timer
 Typedef for the typical usage of timer.


Functions

template<typename Expr> expression< Expr > make_expression (Expr expr)
 Create an expression object using template type deduction.

template<typename Value> expression< value_eq_error<
Value > > 
operator== (Value value, error_t)
 Compare the error for equality with a given value.

template<typename Value> expression< value_eq_error<
Value > > 
operator== (error_t, Value value)
 Compare the error for equality with a given value.

template<typename Value> expression< value_neq_error<
Value > > 
operator!= (Value value, error_t)
 Compare the error for inequality with a given value.

template<typename Value> expression< value_neq_error<
Value > > 
operator!= (error_t, Value value)
 Compare the error for inequality with a given value.

template<typename Expr1, typename Expr2> expression< expr_or_expr<
expression< Expr1 >, expression<
Expr2 > > > 
operator|| (expression< Expr1 > expr1, expression< Expr2 > expr2)
 Perform a logical or on two expressions.

template<typename Expr1, typename Expr2> expression< expr_and_expr<
expression< Expr1 >, expression<
Expr2 > > > 
operator && (expression< Expr1 > expr1, expression< Expr2 > expr2)
 Perform a logical and on two expressions.

expression< throw_error_tthrow_error ()
 Always throw an error.

template<typename Expr> expression< throw_error_if_t<
Expr > > 
throw_error_if (Expr expr)
 Throw an error if an expression is true.

template<typename Target> expression< set_error_t< Target > > set_error (Target &target)
 Set a variable to the error.

template<typename Target, typename Expr> expression< set_error_if_t<
Target, Expr > > 
set_error_if (Target &target, Expr expr)
 Set a variable to the error if an expression is true.

template<typename Ostream> expression< log_error_t< Ostream > > log_error (Ostream &ostream)
 Always log an error to a stream.

template<typename Ostream, typename Expr> expression< log_error_if_t<
Ostream, Expr > > 
log_error_if (Ostream &ostream, Expr expr)
 Log an error to a stream if an expression is true.

template<typename Stream> size_t recv (Stream &s, void *data, size_t max_length)
 Read some data from a stream.

template<typename Stream, typename Error_Handler> size_t recv (Stream &s, void *data, size_t max_length, Error_Handler error_handler)
 Read some data from a stream.

template<typename Stream, typename Handler> void async_recv (Stream &s, void *data, size_t max_length, Handler handler)
 Start an asynchronous receive.

template<typename Stream, typename Handler, typename Completion_Context> void async_recv (Stream &s, void *data, size_t max_length, Handler handler, Completion_Context context)
 Start an asynchronous receive.

template<typename Stream> size_t recv_n (Stream &s, void *data, size_t length, size_t *total_bytes_recvd=0)
 Read the specified amount of data from the stream before returning.

template<typename Stream, typename Error_Handler> size_t recv_n (Stream &s, void *data, size_t length, size_t *total_bytes_recvd, Error_Handler error_handler)
 Read the specified amount of data from the stream before returning.

template<typename Stream, typename Handler> void async_recv_n (Stream &s, void *data, size_t length, Handler handler)
 Start an asynchronous receive that will not complete until the specified amount of data has been received.

template<typename Stream, typename Handler, typename Completion_Context> void async_recv_n (Stream &s, void *data, size_t length, Handler handler, Completion_Context context)
 Start an asynchronous receive that will not complete until the specified amount of data has been received.

template<typename Buffered_Stream, typename Decoder> size_t recv_decode (Buffered_Stream &s, Decoder decoder, size_t *total_bytes_recvd=0)
 Read some data from a stream and decode it.

template<typename Buffered_Stream, typename Decoder, typename Error_Handler> size_t recv_decode (Buffered_Stream &s, Decoder decoder, size_t *total_bytes_recvd, Error_Handler error_handler)
 Read some data from a stream and decode it.

template<typename Buffered_Stream, typename Decoder, typename Handler> void async_recv_decode (Buffered_Stream &s, Decoder decoder, Handler handler)
 Start an asynchronous receive that will not complete until some data has been fully decoded.

template<typename Buffered_Stream, typename Decoder, typename Handler, typename Completion_Context> void async_recv_decode (Buffered_Stream &s, Decoder decoder, Handler handler, Completion_Context context)
 Start an asynchronous receive that will not complete until some data has been fully decoded.

template<typename Buffered_Stream> size_t recv_until (Buffered_Stream &s, std::string &data, const std::string &delimiter, size_t *total_bytes_recvd=0)
 Read data from the stream until a delimiter is reached.

template<typename Buffered_Stream, typename Error_Handler> size_t recv_until (Buffered_Stream &s, std::string &data, const std::string &delimiter, size_t *total_bytes_recvd, Error_Handler error_handler)
 Read data from the stream until a delimiter is reached.

template<typename Buffered_Stream, typename Handler> void async_recv_until (Buffered_Stream &s, std::string &data, const std::string &delimiter, Handler handler)
 Start an asynchronous receive that will not complete until the specified delimiter is encountered.

template<typename Buffered_Stream, typename Handler, typename Completion_Context> void async_recv_until (Buffered_Stream &s, std::string &data, const std::string &delimiter, Handler handler, Completion_Context context)
 Start an asynchronous receive that will not complete until the specified delimiter is encountered.

template<typename Stream> size_t send (Stream &s, const void *data, size_t length)
 Write some data to a stream.

template<typename Stream, typename Error_Handler> size_t send (Stream &s, const void *data, size_t length, Error_Handler error_handler)
 Write some data to a stream.

template<typename Stream, typename Handler> void async_send (Stream &s, const void *data, size_t length, Handler handler)
 Start an asynchronous send.

template<typename Stream, typename Handler, typename Completion_Context> void async_send (Stream &s, const void *data, size_t length, Handler handler, Completion_Context context)
 Start an asynchronous send.

template<typename Stream> size_t send_n (Stream &s, const void *data, size_t length, size_t *total_bytes_sent=0)
 Write all of the given data to the stream before returning.

template<typename Stream, typename Error_Handler> size_t send_n (Stream &s, const void *data, size_t length, size_t *total_bytes_sent, Error_Handler error_handler)
 Write all of the given data to the stream before returning.

template<typename Stream, typename Handler> void async_send_n (Stream &s, const void *data, size_t length, Handler handler)
 Start an asynchronous send that will not complete until the specified amount of data has been sent.

template<typename Stream, typename Handler, typename Completion_Context> void async_send_n (Stream &s, const void *data, size_t length, Handler handler, Completion_Context context)
 Start an asynchronous send that will not complete until the specified amount of data has been sent.


Variables

error_t error
 This variable is used as a placeholder for the error value.


Detailed Description

The asio namespace defines all user-accessible classes and templates.

Typedef Documentation

typedef basic_demuxer< implementation_defined > demuxer
 

Typedef for typical usage of demuxer.

typedef basic_dgram_socket< implementation_defined > dgram_socket
 

Typedef for the typical usage of dgram_socket.

typedef basic_socket_acceptor< implementation_defined > socket_acceptor
 

Typedef for the typical usage of socket_acceptor.

typedef basic_socket_connector< implementation_defined > socket_connector
 

Typedef for the typical usage of socket_connector.

typedef basic_stream_socket< implementation_defined > stream_socket
 

Typedef for the typical usage of stream_socket.

typedef basic_timer< implementation_defined > timer
 

Typedef for the typical usage of timer.


Function Documentation

expression<Expr> make_expression Expr  expr  ) 
 

Create an expression object using template type deduction.

expression<value_eq_error<Value> > operator== Value  value,
error_t 
 

Compare the error for equality with a given value.

expression<value_eq_error<Value> > operator== error_t  ,
Value  value
 

Compare the error for equality with a given value.

expression<value_neq_error<Value> > operator!= Value  value,
error_t 
 

Compare the error for inequality with a given value.

expression<value_neq_error<Value> > operator!= error_t  ,
Value  value
 

Compare the error for inequality with a given value.

expression<expr_or_expr<expression<Expr1>, expression<Expr2> > > operator|| expression< Expr1 >  expr1,
expression< Expr2 >  expr2
 

Perform a logical or on two expressions.

expression<expr_and_expr<expression<Expr1>, expression<Expr2> > > operator && expression< Expr1 >  expr1,
expression< Expr2 >  expr2
 

Perform a logical and on two expressions.

expression<throw_error_t> throw_error  ) 
 

Always throw an error.

expression<throw_error_if_t<Expr> > throw_error_if Expr  expr  ) 
 

Throw an error if an expression is true.

expression<set_error_t<Target> > set_error Target &  target  ) 
 

Set a variable to the error.

expression<set_error_if_t<Target, Expr> > set_error_if Target &  target,
Expr  expr
 

Set a variable to the error if an expression is true.

expression<log_error_t<Ostream> > log_error Ostream &  ostream  ) 
 

Always log an error to a stream.

expression<log_error_if_t<Ostream, Expr> > log_error_if Ostream &  ostream,
Expr  expr
 

Log an error to a stream if an expression is true.

size_t recv Stream &  s,
void *  data,
size_t  max_length
 

Read some data from a stream.

This function is used to receive data on a stream. The function call will block until data has received successfully or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written.
max_length The maximum size of the data to be received, in bytes.
Returns:
The number of bytes received, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's recv operation.

The recv operation may not receive all of the requested number of bytes. Consider using the asio::recv_n() function if you need to ensure that the requested amount of data is received before the blocking operation completes.

size_t recv Stream &  s,
void *  data,
size_t  max_length,
Error_Handler  error_handler
 

Read some data from a stream.

This function is used to receive data on a stream. The function call will block until data has received successfully or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written.
max_length The maximum size of the data to be received, in bytes.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's recv operation)
 ); 
Returns:
The number of bytes received, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
The recv operation may not receive all of the requested number of bytes. Consider using the asio::recv_n() function if you need to ensure that the requested amount of data is received before the blocking operation completes.

void async_recv Stream &  s,
void *  data,
size_t  max_length,
Handler  handler
 

Start an asynchronous receive.

This function is used to asynchronously receive data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written. Ownership of the buffer is retained by the caller, which must guarantee that it is valid until the handler is called.
max_length The maximum size of the data to be received, in bytes.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,   // Result of operation (the actual type is dependent
                         // on the underlying stream's recv operation)
   size_t bytes_received // Number of bytes received
 ); 
Note:
The recv operation may not receive all of the requested number of bytes. Consider using the asio::async_recv_n() function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.

void async_recv Stream &  s,
void *  data,
size_t  max_length,
Handler  handler,
Completion_Context  context
 

Start an asynchronous receive.

This function is used to asynchronously receive data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written. Ownership of the buffer is retained by the caller, which must guarantee that it is valid until the handler is called.
max_length The maximum size of the data to be received, in bytes.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,   // Result of operation (the actual type is dependent
                         // on the underlying stream's recv operation)
   size_t bytes_received // Number of bytes received
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.
Note:
The recv operation may not receive all of the requested number of bytes. Consider using the asio::async_recv_n() function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.

size_t recv_n Stream &  s,
void *  data,
size_t  length,
size_t *  total_bytes_recvd = 0
 

Read the specified amount of data from the stream before returning.

This function is used to receive an exact number of bytes of data on a stream. The function call will block until the specified number of bytes has been received successfully or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written.
length The size of the data to be received, in bytes.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's recv operation.

size_t recv_n Stream &  s,
void *  data,
size_t  length,
size_t *  total_bytes_recvd,
Error_Handler  error_handler
 

Read the specified amount of data from the stream before returning.

This function is used to receive an exact number of bytes of data on a stream. The function call will block until the specified number of bytes has been received successfully or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written.
length The size of the data to be received, in bytes.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's recv operation)
 ); 
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.

void async_recv_n Stream &  s,
void *  data,
size_t  length,
Handler  handler
 

Start an asynchronous receive that will not complete until the specified amount of data has been received.

This function is used to asynchronously receive an exact number of bytes of data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written. Ownership of the buffer is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be received, in bytes.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 

void async_recv_n Stream &  s,
void *  data,
size_t  length,
Handler  handler,
Completion_Context  context
 

Start an asynchronous receive that will not complete until the specified amount of data has been received.

This function is used to asynchronously receive an exact number of bytes of data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The buffer into which the received data will be written. Ownership of the buffer is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be received, in bytes.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.

size_t recv_decode Buffered_Stream &  s,
Decoder  decoder,
size_t *  total_bytes_recvd = 0
 

Read some data from a stream and decode it.

This function is used to receive data on a stream and decode it in a single operation. The function call will block until the decoder function object indicates that it has finished.

Parameters:
s The stream on which the data is to be received.
decoder The decoder function object to be called to decode the received data. The function object is assumed to be stateful. That is, it may not be given sufficient data in a single invocation to complete decoding, and is expected to maintain state so that it may resume decoding when the next piece of data is supplied. Copies will be made of the decoder function object as required, however with respect to maintaining state it can rely on the fact that only an up-to-date copy will be used. The equivalent function signature of the handler must be:
 std::pair<bool, const char*> decoder(
   const char* begin, // Pointer to the beginning of data to be decoded.
   const char* end    // Pointer to one-past-the-end of data to be decoded.
 ); 
The first element of the return value is true if the decoder has finished. The second element is a pointer to the beginning of the unused portion of the data.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's recv operation.

size_t recv_decode Buffered_Stream &  s,
Decoder  decoder,
size_t *  total_bytes_recvd,
Error_Handler  error_handler
 

Read some data from a stream and decode it.

This function is used to receive data on a stream and decode it in a single operation. The function call will block until the decoder function object indicates that it has finished.

Parameters:
s The stream on which the data is to be received.
decoder The decoder function object to be called to decode the received data. The function object is assumed to be stateful. That is, it may not be given sufficient data in a single invocation to complete decoding, and is expected to maintain state so that it may resume decoding when the next piece of data is supplied. Copies will be made of the decoder function object as required, however with respect to maintaining state it can rely on the fact that only an up-to-date copy will be used. The equivalent function signature of the handler must be:
 std::pair<bool, const char*> decoder(
   const char* begin, // Pointer to the beginning of data to be decoded.
   const char* end    // Pointer to one-past-the-end of data to be decoded.
 ); 
The first element of the return value is true if the decoder has finished. The second element is a pointer to the beginning of the unused portion of the data.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's recv operation)
 ); 
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.

void async_recv_decode Buffered_Stream &  s,
Decoder  decoder,
Handler  handler
 

Start an asynchronous receive that will not complete until some data has been fully decoded.

This function is used to receive data on a stream and decode it in a single asynchronous operation. The function call always returns immediately. The asynchronous operation will complete only when the decoder indicates that it has finished.

Parameters:
s The stream on which the data is to be received.
decoder The decoder function object to be called to decode the received data. The function object is assumed to be stateful. That is, it may not be given sufficient data in a single invocation to complete decoding, and is expected to maintain state so that it may resume decoding when the next piece of data is supplied. Copies will be made of the decoder function object as required, however with respect to maintaining state it can rely on the fact that only an up-to-date copy will be used. The equivalent function signature of the handler must be:
 std::pair<bool, const char*> decoder(
   const char* begin, // Pointer to the beginning of data to be decoded.
   const char* end    // Pointer to one-past-the-end of data to be decoded.
 ); 
The first element of the return value is true if the decoder has finished. The second element is a pointer to the beginning of the unused portion of the data.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 

void async_recv_decode Buffered_Stream &  s,
Decoder  decoder,
Handler  handler,
Completion_Context  context
 

Start an asynchronous receive that will not complete until some data has been fully decoded.

This function is used to receive data on a stream and decode it in a single asynchronous operation. The function call always returns immediately. The asynchronous operation will complete only when the decoder indicates that it has finished.

Parameters:
s The stream on which the data is to be received.
decoder The decoder function object to be called to decode the received data. The function object is assumed to be stateful. That is, it may not be given sufficient data in a single invocation to complete decoding, and is expected to maintain state so that it may resume decoding when the next piece of data is supplied. Copies will be made of the decoder function object as required, however with respect to maintaining state it can rely on the fact that only an up-to-date copy will be used. The equivalent function signature of the handler must be:
 std::pair<bool, const char*> decoder(
   const char* begin, // Pointer to the beginning of data to be decoded.
   const char* end    // Pointer to one-past-the-end of data to be decoded.
 ); 
The first element of the return value is true if the decoder has finished. The second element is a pointer to the beginning of the unused portion of the data.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.

size_t recv_until Buffered_Stream &  s,
std::string &  data,
const std::string &  delimiter,
size_t *  total_bytes_recvd = 0
 

Read data from the stream until a delimiter is reached.

This function is used to receive data from the stream into a std::string object until a specified delimiter is reached. The function call will block until the delimiter is found or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The std::string object into which the received data will be written.
delimiter The pattern marking the end of the data to receive.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's recv operation.

size_t recv_until Buffered_Stream &  s,
std::string &  data,
const std::string &  delimiter,
size_t *  total_bytes_recvd,
Error_Handler  error_handler
 

Read data from the stream until a delimiter is reached.

This function is used to receive data from the stream into a std::string object until a specified delimiter is reached. The function call will block until the delimiter is found or an error occurs.

Parameters:
s The stream on which the data is to be received.
data The std::string object into which the received data will be written.
delimiter The pattern marking the end of the data to receive.
total_bytes_recvd An optional output parameter that receives the total number of bytes actually received.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's recv operation)
 ); 
Returns:
The number of bytes received on the last recv, or 0 if end-of-file was reached or the connection was closed cleanly.

void async_recv_until Buffered_Stream &  s,
std::string &  data,
const std::string &  delimiter,
Handler  handler
 

Start an asynchronous receive that will not complete until the specified delimiter is encountered.

This function is used to asynchronously receive data from a stream until a given delimiter is found. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The std:::string object into which the received data will be written. Ownership of the object is retained by the caller, which must guarantee that it is valid until the handler is called.
delimiter The pattern marking the end of the data to receive. Copies will be made of the string as required.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 

void async_recv_until Buffered_Stream &  s,
std::string &  data,
const std::string &  delimiter,
Handler  handler,
Completion_Context  context
 

Start an asynchronous receive that will not complete until the specified delimiter is encountered.

This function is used to asynchronously receive data from a stream until a given delimiter is found. The function call always returns immediately.

Parameters:
s The stream on which the data is to be received.
data The std:::string object into which the received data will be written. Ownership of the object is retained by the caller, which must guarantee that it is valid until the handler is called.
delimiter The pattern marking the end of the data to receive. Copies will be made of the string as required.
handler The completion handler to be called when the receive operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,       // Result of operation (the actual type is
                             // dependent on the underlying stream's recv
                             // operation)
   size_t total_bytes_recvd, // Total number of bytes successfully received
   size_t last_bytes_recvd   // Number of bytes received on last recv
                             // operation
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.

size_t send Stream &  s,
const void *  data,
size_t  length
 

Write some data to a stream.

This function is used to send data on a stream. The function call will block until the data has been sent successfully or an error occurs.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream.
length The size of the data to be sent, in bytes.
Returns:
The number of bytes sent, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's send operation.

The send operation may not transmit all of the data to the peer. Consider using the asio::send_n() function if you need to ensure that all data is sent before the blocking operation completes.

size_t send Stream &  s,
const void *  data,
size_t  length,
Error_Handler  error_handler
 

Write some data to a stream.

This function is used to send data on a stream. The function call will block until the data has been sent successfully or an error occurs.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream.
length The size of the data to be sent, in bytes.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's send operation)
 ); 
Returns:
The number of bytes sent, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
The send operation may not transmit all of the data to the peer. Consider using the asio::send_n() function if you need to ensure that all data is sent before the blocking operation completes.

void async_send Stream &  s,
const void *  data,
size_t  length,
Handler  handler
 

Start an asynchronous send.

This function is used to asynchronously send data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream. Ownership of the data is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be sent, in bytes.
handler The completion handler to be called when the send operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error, // Result of operation (the actual type is dependent
                       // on the underlying stream's send operation)
   size_t bytes_sent   // Number of bytes sent
 ); 
Note:
The send operation may not transmit all of the data to the peer. Consider using the asio::async_send_n() function if you need to ensure that all data is sent before the asynchronous operation completes.

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

Start an asynchronous send.

This function is used to asynchronously send data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream. Ownership of the data is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be sent, in bytes.
handler The completion handler to be called when the send operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error, // Result of operation (the actual type is dependent
                       // on the underlying stream's send operation)
   size_t bytes_sent   // Number of bytes sent
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.
Note:
The send operation may not transmit all of the data to the peer. Consider using the asio::async_send_n() function if you need to ensure that all data is sent before the asynchronous operation completes.

size_t send_n Stream &  s,
const void *  data,
size_t  length,
size_t *  total_bytes_sent = 0
 

Write all of the given data to the stream before returning.

This function is used to send an exact number of bytes of data on a stream. The function call will block until the specified number of bytes has been sent successfully or an error occurs.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream.
length The size of the data to be sent, in bytes.
total_bytes_sent An optional output parameter that receives the total number of bytes actually sent.
Returns:
The number of bytes sent on the last send, or 0 if end-of-file was reached or the connection was closed cleanly.
Note:
Throws an exception on failure. The type of the exception depends on the underlying stream's send operation.

size_t send_n Stream &  s,
const void *  data,
size_t  length,
size_t *  total_bytes_sent,
Error_Handler  error_handler
 

Write all of the given data to the stream before returning.

This function is used to send an exact number of bytes of data on a stream. The function call will block until the specified number of bytes has been sent successfully or an error occurs.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream.
length The size of the data to be sent, in bytes.
total_bytes_sent An optional output parameter that receives the total number of bytes actually sent.
error_handler The handler to be called when an error occurs. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void error_handler(
   const Error& error // Result of operation (the actual type is dependent on
                      // the underlying stream's send operation)
 ); 
Returns:
The number of bytes sent on the last send, or 0 if end-of-file was reached or the connection was closed cleanly.

void async_send_n Stream &  s,
const void *  data,
size_t  length,
Handler  handler
 

Start an asynchronous send that will not complete until the specified amount of data has been sent.

This function is used to asynchronously send an exact number of bytes of data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream. Ownership of the data is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be sent, in bytes.
handler The completion handler to be called when the send operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,      // Result of operation (the actual type is
                            // dependent on the underlying stream's send
                            // operation)
   size_t total_bytes_sent, // Total number of bytes successfully sent
   size_t last_bytes_sent   // Number of bytes sent on last send operation
 ); 

void async_send_n Stream &  s,
const void *  data,
size_t  length,
Handler  handler,
Completion_Context  context
 

Start an asynchronous send that will not complete until the specified amount of data has been sent.

This function is used to asynchronously send an exact number of bytes of data on a stream. The function call always returns immediately.

Parameters:
s The stream on which the data is to be sent.
data The data to be sent on the stream. Ownership of the data is retained by the caller, which must guarantee that it is valid until the handler is called.
length The size of the data to be sent, in bytes.
handler The completion handler to be called when the send operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 template <typename Error>
 void handler(
   const Error& error,      // Result of operation (the actual type is
                            // dependent on the underlying stream's send
                            // operation)
   size_t total_bytes_sent, // Total number of bytes successfully sent
   size_t last_bytes_sent   // Number of bytes sent on last send operation
 ); 
context The completion context which controls the number of concurrent invocations of handlers that may be made. Copies will be made of the context object as required, however all copies are equivalent.


Variable Documentation

error_t error [static]
 

This variable is used as a placeholder for the error value.