O'Reilly logo
  • Yonathan Dossow thinks this is interesting:

def __init__(self, port, backlog=5): self.clients = 0 self.clientmap = {} self.outputs = [] # list output sockets self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Enable re-using socket address self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.server.bind((SERVER_HOST, port)) print 'Server listening to port: %s ...' %port self.server.listen(backlog) # Catch keyboard interrupts signal.signal(signal.SIGINT, self.sighandler)


Cover of Python Network Programming Cookbook


wrong indent