maybe you can bind to port 0 then just query the socket which port it is on?
i'm speaking from a low level perspective. maybe consult the ruby docs
for socket behavior.

On Mon, 21 Mar 2005 03:50:06 +0900, Sam Roberts <sroberts / uniserve.com> wrote:
> I don't want to use a hard-coded port number, I want it to bind to
> INADDR_ANY with a port of zero. The system will select a free port.
-- 
http://www.eyan.org