I am currently trying to find a way to find the free port number to establish a connection, ideally with boost :: asio. This port number will be used for listening (and only then can I open the socket).
Roughly, is there any way to do
tcp::resolver::query query("localhost", port);
when the port is left empty (setting it to 0 does not work)
None of the options shown previously were portable or effective.
c ++ boost port sockets tcp
user1018513
source share