I have a program that runs fine on both Windows and MacOSX, but encounters the address already used
problem on Linux (Fedora 23, to be specific). The issue turns out to be that I'm trying to construct two boost::asio::ip::tcp::acceptor
objects on the same port, one for IPv4 and one for IPv6. The signature of the constructor used is as follows (see here):
basic_socket_acceptor(
boost::asio::io_service & io_service,
const endpoint_type & endpoint,
bool reuse_addr = true);
Note the reuse_addr
parameter. I expect it to address specifically the address already used
problem. Alas, it does not work on Linux. Any explanation why?