Dec 6
Here’s how to open a server at the next available port, then retrieve the port number:
server = TCPServer.new '127.0.0.1', 0 port = server.addr[1]
(courtesy of stackoverflow / Aaron Hinni).