标签:thread and serve soc 127.0.0.1 cps server ever handler
因为原生tcp不能连接多个用户。所以使用socketserver。
固定代码:
import socketserver
Class A(socketserver.BaseRequestHandler):
def handler(self):
self.request.recv() # 相当于conn
send
close
if __name__ == ‘__main__‘:
ip_port = (‘127.0.0.1‘,8964)
server = socketserver.ThreadingTCPServer(ip_port,A)
server.serve_forever()
标签:thread and serve soc 127.0.0.1 cps server ever handler
原文地址:https://www.cnblogs.com/wjywinner/p/10514983.html