import SocketServerimport netstringimport sysimport stringclass MyRequestHandler(SocketServer.BaseRequestHandler): def handle(self): print "Connected:", self.client_address while 1: rq = netstring.readns(self.request) print "From:", self.client_address, rq sys.stdout.flush() if rq == "": break netstring.writens(self.request, string.upper(rq))myServer = SocketServer.ThreadingTCPServer(('', 8081), MyRequestHandler)myServer.serve_forever()
Name (required)
email (will not be published) (required)
Website