Boost C++ Libraries Home Libraries People FAQ More

Home | Reference | Tutorial | Examples | Design
Reference Index | Class Hierarchy | Class Index | Member Index

Async_Write_Stream Class Reference

Inherits Async_Object, and Error_Source.

Inherited by Stream.

Inheritance diagram for Async_Write_Stream:

Inheritance graph
List of all members.

Detailed Description

Asynchronous write stream concept.

Implemented By:
boost::asio::basic_stream_socket
boost::asio::buffered_read_stream
boost::asio::buffered_write_stream
boost::asio::buffered_stream
boost::asio::ssl::stream


Public Types

typedef implementation_defined io_service_type
 The io_service type for this object.
typedef implementation_defined error_type
 The type used for reporting errors.

Public Member Functions

template<typename Const_Buffers, typename Handler>
void async_write_some (const Const_Buffers &buffers, Handler handler)
 Start an asynchronous write.
io_service_typeio_service ()
 Get the io_service associated with the object.


Member Typedef Documentation

typedef implementation_defined Async_Object::io_service_type [inherited]

The io_service type for this object.

typedef implementation_defined Error_Source::error_type [inherited]

The type used for reporting errors.


Member Function Documentation

template<typename Const_Buffers, typename Handler>
void Async_Write_Stream::async_write_some ( const Const_Buffers buffers,
Handler  handler 
)

Start an asynchronous write.

This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.

Parameters:
buffers The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called.
handler The handler to be called when the write operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be:
 void handler(
   const Async_Write_Stream::error_type& error, // Result of operation.
   std::size_t bytes_transferred                // Number of bytes written.
 ); 
Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post().

io_service_type& Async_Object::io_service (  )  [inherited]

Get the io_service associated with the object.

This function may be used to obtain the io_service object that the object uses to dispatch handlers for asynchronous operations.

Returns:
A reference to the io_service object that the object will use to dispatch handlers. Ownership is not transferred to the caller.

Copyright © 2003 - 2006 Christopher M. Kohlhoff


Home | Reference | Tutorial | Examples | Design