boost::corosio::tcp
Encapsulate the TCP protocol for socket creation.
Synopsis
Declared in <boost/corosio/tcp.hpp>
class tcp;
Description
This class identifies the TCP protocol and its address family (IPv4 or IPv6). It is used to parameterize socket and acceptor open() calls with a self‐documenting type.
The family(), type(), and protocol() members are implemented in the compiled library to avoid exposing platform socket headers. For an inline variant that includes platform headers, use native_tcp.
Example
tcp_acceptor acc( ioc );
acc.open( tcp::v6() ); // IPv6 socket
acc.set_option( socket_option::reuse_address( true ) );
acc.bind( endpoint( ipv6_address::any(), 8080 ) );
acc.listen();
Member Functions
Name |
Description |
Return the address family (AF_INET or AF_INET6). |
|
Return true if this is IPv6. |
See Also
native_tcp, tcp_socket, tcp_acceptor
Created with MrDocs