from SocketServer import (TCPServer as TCP, StreamRequestHandler as SRH)from time import ctimeHOST = '127.0.0.1'PORT = 21567ADDR = (HOST, PORT)class MyRequestHandler(SRH): def handle(self): print '...connected from:', self.client_address self.wfile.write('[%s] %s' % (ctime(), self.rfile.readline()))tcpServ = TCP(ADDR, MyRequestHandler)print 'waiting for connection...'tcpServ.serve_forever()
Name (required)
email (will not be published) (required)
Website