Import Socketserver

Class MyServer(socketserver.BaseRequestHandler):

Def handle(self):

Self.request 相当于 conn

If __name__==’__main__’:

Ip_port = (‘127.0.0.1’,8001)

Server = socketserver.ThreadingTCPServer(ip_port,MyServer)

Server.serve_forever()

请求的意思Request

响应:response