boost::corosio::tcp_acceptor::open

Create the acceptor socket without binding or listening.

Synopsis

void
open(tcp proto = tcp::v4());

Description

Creates a TCP socket with dual‐stack enabled for IPv6. Does not set SO_REUSEADDR — call set_option explicitly if needed.

If the acceptor is already open, this function is a no‐op.

Example

acc.open( tcp::v6() );
acc.set_option( socket_option::reuse_address( true ) );
acc.bind( endpoint( ipv6_address::any(), 8080 ) );
acc.listen();

Exceptions

Name

Thrown on

std::system_error

on failure.

Parameters

Name

Description

proto

The protocol (IPv4 or IPv6). Defaults to tcp::v4().

See Also

bind, listen

Created with MrDocs