Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (14 sloc) 353 Bytes
#!/usr/bin/env python
import sys
import os
import socket
prog = sys.argv.pop(0)
host = sys.argv.pop(0)
port = int(sys.argv.pop(0))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host, port))
s.listen(32)
os.dup2(s.fileno(),0)
os.close(s.fileno())
os.execvp(sys.argv[0],sys.argv)