-
-
Save ruanbekker/647dbfd9da92bf35d93b275f12e00ffd to your computer and use it in GitHub Desktop.
Revisions
-
jdavis created this gist
Nov 8, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ import socket def find_open_port(): """ Use socket's built in ability to find an open port. """ sock = socket.socket() sock.bind(('', 0)) _, port = sock.getsockname() return port print find_open_port()