Artifact 97bc56ed90e682a7bcf6de410ec51c27b137ba25:
- Executable file find_free_port — part of check-in [c38a852bdf] at 2015-11-10 14:51:12 on branch trunk — start to implement setup wizard (user: vitus, size: 332) [annotate] [blame] [check-ins using]
#!/usr/bin/python import os,sys,re f=os.popen("netstat -nlt4","r") if len(sys.argv)>1: start=int(sys.argv[1]) else: start=5900 s=set() for line in f: if not line.startswith("tcp"): continue m=re.search(":(\\d+)\\b",line) if m: s.add(int(m.group(1))) i=start while i in s: i += 1 print i