Created
July 3, 2014 14:55
-
-
Save pathologicalhandwaving/1f7c1024a31bd350e6cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_free_port(): | |
s = socket.socket() | |
s.bind(('', 0)) | |
port = s.getsockname()[1] | |
s.close() | |
return port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment