Quoting eemoragas / gmail.com, on Mon, Mar 21, 2005 at 03:59:32AM +0900:
> maybe you can bind to port 0 then just query the socket which port it is on?

Maybe it wasn't clear, I'm asking about how to do this with WEBrick.

I don't create the socket, WEBrick does. I can't find a WEBrick API that
gives me back the socket, so I don't have a way to call
#getsockname on it to find the port.

I also can't find a WEBrick API where I create the TCPSocket and pass it
in, that would work for me, too.

So that's my question... how do I access the underlying socket so I
can call #getsockname and find what port its listening on?

Thanks,
Sam

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