Wednesday, February 17, 2010

Opening a Server at the next available free port

And also getting the port number back!
server = TCPServer.new '127.0.0.1', 0
port = server.addr[1]


(courtesy of stackoverflow / Aaron Hinni).

0 comments:

Post a Comment