Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit d7c8a7cf0d.
PrevUpHomeNext

UNIX sockets and other stream types

The connection class is templatized on the stream type. Any object fulfilling the Stream concept may be used as template argument.

Convenience type aliases

This library provides helper type aliases for the most common cases:

Transport

Stream type

Type alias

SSL over TCP

boost::asio::ssl::stream<boost::asio::ip::tcp::socket>

tcp_ssl_connection

Plaintext TCP

boost::asio::ip::tcp::socket

tcp_connection

UNIX sockets

boost::asio::local::stream_protocol::socket

unix_connection

Only available if BOOST_ASIO_HAS_LOCAL_SOCKETS is defined.

This example employs a UNIX domain socket to establish a connection to a MySQL server.

Streams that are not sockets

When the Stream template argument for your connection fulfills the SocketStream type requirements, you can use the member functions connection::connect and connection::close to establish and finish connections with the MySQL server. If you are using any of the convenience type aliases (TCP or UNIX, either over TLS or not), then this is your case.

If your stream type is not based on a socket, you can't use those convenience member functions. This would be the case if you are using Windows named pipes (i.e. boost::asio::windows::stream_handle). Instead, to establish a connection, you should follow these two steps, roughly equivalent to what connection::connect does for sockets:

To clean up a connection, follow these two steps, roughly equivalent to connection::close:


PrevUpHomeNext