| Home | Libraries | People | FAQ | More

# Sync_Write_Stream Class Reference

Inherits Error_Source.

Inherited by Stream.

Inheritance diagram for Sync_Write_Stream:

List of all members.

## Detailed Description

Synchronous 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 | error_type
| The type used for reporting errors.

## Public Member Functions

template<typename Const_Buffers>
std::size_t | write_some (const Const_Buffers &buffers)
| Write the given data on the stream.
template<typename Const_Buffers, typename Error_Handler>
std::size_t | write_some (const Const_Buffers &buffers, Error_Handler error_handler)
| Write the given data on the stream.

## Member Typedef Documentation

typedef implementation_defined Error_Source::error_type`[inherited]`

The type used for reporting errors.

## Member Function Documentation

template<typename Const_Buffers>

std::size_t Sync_Write_Stream::write_some | ( | const Const_Buffers & | buffers | ) |

Write the given data on the stream.

This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.

Parameters:

  | buffers | The data to be written.

Returns:
  The number of bytes written.

Exceptions:

  | Sync_Write_Stream::error_type | Thrown on failure.

template<typename Const_Buffers, typename Error_Handler>

std::size_t Sync_Write_Stream::write_some | ( | const Const_Buffers & | buffers,
|  | Error_Handler | error_handler |
| ) |  |  |

Write the given data on the stream.

This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.

Parameters:

  | buffers | The data to be written.
  | 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:
       void error_handler(
         const Sync_Write_Stream::error_type& error // Result of operation.
       );

Returns:
  The number of bytes written. Returns 0 if an error occurred and the error handler did not throw an exception.

| Copyright © 2003 - 2006 Christopher M. Kohlhoff