Artifact 6153a27ecd2b0b327b0821e9455c3136893625aa:
- Executable file find_free_port — part of check-in [83455d7349] at 2017-01-14 11:15:49 on branch trunk — Replaced find_free_port with more generic version (user: vitus, size: 387) [annotate] [blame] [check-ins using]
#!/usr/bin/python import sys,socket,errno if len(sys.argv)>1: port=int(sys.argv[1]) else: port=5900 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: try: s.bind(("",port)) except socket.error as e: if e.errno== errno.EADDRINUSE: port+=1 continue else: raise e break s.close() print port