Hi,

In message <20050320193414.GD911 / ensemble.local>,
 `Sam Roberts <sroberts / uniserve.com>' wrote:
> 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.

WEBrick::GenericServer#listen and #listeners may be useful.

% ruby -r webrick -e '
s=WEBrick::HTTPServer.new(:Port=>0)
p s.listeners
s.listeners << TCPServer.new("127.0.0.1", "8080") # add a socket to listeners
s.listen("127.0.0.1", 8081)                       # ditto.
p s.listeners
'
[2005-03-21 04:43:58] INFO  WEBrick 1.3.1
[2005-03-21 04:43:58] INFO  ruby 1.9.0 (2005-03-20) [i386-netbsd]
[#<TCPServer:0x8314264>, #<TCPServer:0x83141c4>]
[#<TCPServer:0x8314264>, #<TCPServer:0x83141c4>, #<TCPServer:0x8314048>, #<TCPServer:0x8313f08>]

-- 
gotoyuzo