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 an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

basic_socket_streambuf::reuse_address

Inherited from socket_base.

Socket option to allow the socket to be bound to an address that is already in use.

typedef implementation_defined reuse_address;

Implements the SOL_SOCKET/SO_REUSEADDR socket option.

Examples

Setting the option:

boost::asio::ip::tcp::acceptor acceptor(io_service); 
...
boost::asio::socket_base::reuse_address option(true);
acceptor.set_option(option);

Getting the current option value:

boost::asio::ip::tcp::acceptor acceptor(io_service); 
...
boost::asio::socket_base::reuse_address option;
acceptor.get_option(option);
bool is_set = option.value();

PrevUpHomeNext