asio C++ library

PrevUpHomeNext

basic_seq_packet_socket::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:

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

Getting the current option value:

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

Header: asio/basic_seq_packet_socket.hpp

Convenience header: asio.hpp


PrevUpHomeNext