check for unused ports and then grab one

Brad Tilley bradtilley at usa.net
Mon Sep 13 16:31:06 EDT 2004


Instead of me arbitrarily assigning a high port number to a variable, is 
it possible to check for ports that are unused and then randomly assign 
one of them to a variable? Something like this is what I'm thinking:

port = socket.getunusedport()

Any ideas?



More information about the Python-list mailing list