Artifact 3dfec6d4ec947287522ceffc49524347db748aef:
- Executable file find_free_port — part of check-in [5bd9419845] at 2019-10-01 19:29:36 on branch trunk — Made debian package ver 0.8. Removed lintian warining. Converted find_free_port to python3 (user: vitus, size: 398) [annotate] [blame] [check-ins using]
#!/usr/bin/python3 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)