CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | List of all members
booster::aio::stream_socket Class Reference

This object represents a stream socket: TCP/IP IPv4 or IPv6 or Unix domain stream socket. More...

`#include <booster/booster/aio/stream_socket.h>`

Inheritance diagram for booster::aio::stream_socket:

## Public Types
enum | how_type { shut_rd, shut_wr, shut_rdwr }
Public Types inherited from booster::aio::basic_socket
enum | boolean_option_type { tcp_no_delay, keep_alive, reuse_address }
enum | integer_option_type { receive_buffer_size, send_buffer_size }

## Public Member Functions
| stream_socket ()
| stream_socket (io_service &srv)
void | open (family_type d)
void | open (family_type d, system::error_code &e)
void | shutdown (how_type h)
void | shutdown (how_type h, system::error_code &e)
void | connect (endpoint const &ep)
void | connect (endpoint const &ep, system::error_code &e)
void | async_connect (endpoint const &ep, event_handler const &h)
size_t | read_some (mutable_buffer const &buffer)
size_t | read_some (mutable_buffer const &buffer, system::error_code &e)
size_t | write_some (const_buffer const &buffer)
size_t | write_some (const_buffer const &buffer, system::error_code &e)
size_t | read (mutable_buffer const &buffer)
size_t | write (const_buffer const &buffer)
size_t | read (mutable_buffer const &buffer, system::error_code &e)
size_t | write (const_buffer const &buffer, system::error_code &e)
void | async_read_some (mutable_buffer const &buffer, io_handler const &h)
void | async_write_some (const_buffer const &buffer, io_handler const &h)
void | async_read (mutable_buffer const &buffer, io_handler const &h)
void | async_write (const_buffer const &buffer, io_handler const &h)
size_t | bytes_readable (booster::system::error_code &e)
size_t | bytes_readable ()
Public Member Functions inherited from booster::aio::basic_socket
| basic_socket ()
| basic_socket (io_service &srv)
void | open (family_type d, socket_type t)
void | open (family_type d, socket_type t, system::error_code &e)
endpoint | local_endpoint (system::error_code &e)
endpoint | local_endpoint ()
endpoint | remote_endpoint (system::error_code &e)
endpoint | remote_endpoint ()
bool | get_option (boolean_option_type opt, system::error_code &e)
bool | get_option (boolean_option_type opt)
void | set_option (boolean_option_type opt, bool v, system::error_code &e)
void | set_option (boolean_option_type opt, bool v)
int | get_option (integer_option_type opt, system::error_code &e)
int | get_option (integer_option_type opt)
void | set_option (integer_option_type opt, int v, system::error_code &e)
void | set_option (integer_option_type opt, int v)
void | bind (endpoint const &ep)
void | bind (endpoint const &ep, system::error_code &e)
Public Member Functions inherited from booster::aio::basic_io_device
| basic_io_device ()
| basic_io_device (io_service &srv)
virtual | ~basic_io_device ()
bool | has_io_service ()
io_service & | get_io_service ()
void | set_io_service (io_service &srv)
void | reset_io_service ()
void | attach (native_type fd)
void | assign (native_type fd)
native_type | release ()
native_type | native ()
void | close ()
void | close (system::error_code &e)
void | on_readable (event_handler const &r)
void | on_writeable (event_handler const &r)
void | cancel ()
basic_io_device & | lowest_layer ()
void | set_non_blocking (bool nonblocking)
void | set_non_blocking (bool nonblocking, system::error_code &e)
void | set_non_blocking_if_needed (bool nonblocking)
void | set_non_blocking_if_needed (bool nonblocking, system::error_code &e)

## Additional Inherited Members
Static Public Member Functions inherited from booster::aio::basic_io_device
static bool | would_block (system::error_code const &e)
Protected Member Functions inherited from booster::aio::basic_io_device
bool | dont_block (event_handler const &c)
bool | dont_block (io_handler const &c)

## Detailed Description

This object represents a stream socket: TCP/IP IPv4 or IPv6 or Unix domain stream socket.

## Member Enumeration Documentation

enum booster::aio::stream_socket::how_type

Shutdown option type

## Constructor & Destructor Documentation

booster::aio::stream_socket::stream_socket | ( |  | ) |

Create a new (closed) stream socket

booster::aio::stream_socket::stream_socket | ( | io_service & | srv | ) |

Create a new (closed) stream socket and attach the object to io_service srv

## Member Function Documentation

void booster::aio::stream_socket::async_connect | ( | endpoint const & | ep,
|  | event_handler const & | h
| ) |  |

Connect asynchronously to the remote endpoint ep.

If io_service is not assigned throws system::system_error, all other errors reported via the callback h.

void booster::aio::stream_socket::async_read | ( | mutable_buffer const & | buffer,
|  | io_handler const & | h
| ) |  |

Read asynchronously from the socket to the buffer until all required mount of data is transfered.

The error and the amount of bytes that are transfered are reported via callback. During the operation the buffers (the data range it points to) must remain valid.

If io_service is not assigned throws system::system_error, all other errors reported via the callback h.

void booster::aio::stream_socket::async_read_some | ( | mutable_buffer const & | buffer,
|  | io_handler const & | h
| ) |  |

Read asynchronously from the socket to the buffer.

The error and the amount of bytes that are transfered are reported via callback. During the operation the buffers (the data range it points to) must remain valid.

If io_service is not assigned throws system::system_error, all other errors reported via the callback h.

void booster::aio::stream_socket::async_write | ( | const_buffer const & | buffer,
|  | io_handler const & | h
| ) |  |

Write asynchronously to the socket from the buffer until all required mount of data is transfered.

The error and the amount of bytes that are transfered are reported via callback. During the operation the buffers (the data range it points to) must remain valid.

If io_service is not assigned throws system::system_error, all other errors reported via the callback h.

void booster::aio::stream_socket::async_write_some | ( | const_buffer const & | buffer,
|  | io_handler const & | h
| ) |  |

Write asynchronously to the socket from the buffer.

The error and the amount of bytes that are transfered are reported via callback. During the operation the buffers (the data range it points to) must remain valid.

If io_service is not assigned throws system::system_error, all other errors reported via the callback h.

size_t booster::aio::stream_socket::bytes_readable | ( | booster::system::error_code & | e | ) |

Return a number of avalible bytes to read, if error occurs returns 0 and e set to the error code

New in CppCMS 1.2

size_t booster::aio::stream_socket::bytes_readable | ( |  | ) |

Return a number of avalible bytes to read, if error occurs system_error is thrown

New in CppCMS 1.2

void booster::aio::stream_socket::connect | ( | endpoint const & | ep | ) |

Connect to the remote endpoint ep

Throws system::system_error if error occurs.

void booster::aio::stream_socket::connect | ( | endpoint const & | ep,
|  | system::error_code & | e
| ) |  |

Connect to the remote endpoint ep

If a error occurs it is assigned to e.

void booster::aio::stream_socket::open | ( | family_type | d | ) |

Opens a new stream socket of a family_type d

Throws system::system_error if error occurs.

void booster::aio::stream_socket::open | ( | family_type | d,
|  | system::error_code & | e
| ) |  |

Opens a new stream socket of a family_type d

If a error occurs it is assigned to e.

size_t booster::aio::stream_socket::read | ( | mutable_buffer const & | buffer | ) |

Read from the socket to the buffer until all required data is transferred. Returns the number of bytes transfered

Throws system::system_error if error occurs.

size_t booster::aio::stream_socket::read | ( | mutable_buffer const & | buffer,
|  | system::error_code & | e
| ) |  |

Read from the socket to the buffer until all required data is transferred. Returns the number of bytes transfered

If a error occurs it is assigned to e.

size_t booster::aio::stream_socket::read_some | ( | mutable_buffer const & | buffer | ) |

Read from the socket to the buffer. Returns the number of bytes transfered

Throws system::system_error if error occurs.

size_t booster::aio::stream_socket::read_some | ( | mutable_buffer const & | buffer,
|  | system::error_code & | e
| ) |  |

Read from the socket to the buffer. Returns the number of bytes transfered

If a error occurs it is assigned to e.

void booster::aio::stream_socket::shutdown | ( | how_type | h | ) |

Notify the other side on connection shutdown of a type h

Throws system::system_error if error occurs.

void booster::aio::stream_socket::shutdown | ( | how_type | h,
|  | system::error_code & | e
| ) |  |

Notify the other side on connection shutdown of a type h

If a error occurs it is assigned to e.

size_t booster::aio::stream_socket::write | ( | const_buffer const & | buffer | ) |

Write to the socket from the buffer until all required data is transferred. Returns the number of bytes transfered

Throws system::system_error if error occurs.

size_t booster::aio::stream_socket::write | ( | const_buffer const & | buffer,
|  | system::error_code & | e
| ) |  |

Write to the socket from the buffer until all required data is transferred. Returns the number of bytes transfered

If a error occurs it is assigned to e.

size_t booster::aio::stream_socket::write_some | ( | const_buffer const & | buffer | ) |

Write to the socket from the buffer. Returns the number of bytes transfered

Throws system::system_error if error occurs.

size_t booster::aio::stream_socket::write_some | ( | const_buffer const & | buffer,
|  | system::error_code & | e
| ) |  |

Write to the socket from the buffer. Returns the number of bytes transfered

If a error occurs it is assigned to e.

The documentation for this class was generated from the following file:

- booster/aio/stream_socket.h