Python: SocketServer closes TCP connection unexpectedly
问题 I would like to implement a TCP/IP network client application that sends requests to a Python SocketServer and expects responses in return. I have started out with the official Python SocketServer sample code: server.py: #!/usr/bin/env python # encoding: utf-8 import SocketServer class MyTCPHandler(SocketServer.StreamRequestHandler): def handle(self): request = self.rfile.readline().strip() print "RX [%s]: %s" % (self.client_address[0], request) response = self.processRequest(request) print