标签:threading eve 自定义 调用 wan for shu int ever
# ###服务端 import socketserver class MyServer(socketserver.BaseRequestHandler): # 在handle里面自定义收发逻辑 def handle(self): print("--->这句话被执行了") conn = self.request while True: msg = conn.recv(1024).decode("utf-8") print(msg) conn.send(msg.upper().encode("utf-8")) # 产生一个对象 server = socketserver.ThreadingTCPServer( ("127.0.0.1",9000) ,MyServer ) # 循环调用 server.serve_forever() # ###客户端 import socket sk = socket.socket() sk.connect( ("127.0.0.1",9000) ) while True: sk.send(b"wangwen_dashuaguo") msg = sk.recv(1024) print(msg) sk.close()
socketserver 服务端 | 客户端 实现并发效果2
标签:threading eve 自定义 调用 wan for shu int ever
原文地址:https://www.cnblogs.com/huangjiangyong/p/10960981.html