|
Boost Users : |
Subject: [Boost-users] asio newbie: picking a free port number
From: Avi Bahra (avibahra_at_[hidden])
Date: 2010-02-23 08:15:18
I am writing a simple client/server program which will only run
on Unix boxes (linux, HP-UX, AIX).
By manually choosing the port number,everything works ok.
Whenever I get an "Address in use" i choose a different number.
I want to free clients of this program from having to do this.
>From googling around it appears that there is way of the OS, to pick
a free port number. i.e by binding to port 0, sock.bind(('', 0))/
sock.getsockname()[1]
Is there any boost:asio recommended way of doing this ?
Is there any way of completely abstracting out the use of port numbers from
an
end users perspective using boost asio ? i.e so that client/server agree
on a free port number behind the scenes.
Any help appreciated.
Best regards,
Ta,
Avi
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net