标签:开发 font socket 客户 ase hid _for self mys
socketserver模块介绍:
分成两大类:一类是处理链接的,server类;一类是处理通信的,request类
Forking 进程 Threading 线程 都跟开发有关
多进程系统开销高于多线程,一般用多线程
import socketserver class MyServer(socketserver.BaseRequestHandler): def handle(self): print(‘conn is:‘,self.request) print(‘addr is:‘,self.client_address) while True: msg=self.request.recv(1024) print(‘收到客户端的消息‘,msg,self.client_address) self.request.sendall(msg.upper()) if __name__==‘__main__‘: s=socketserver.ThreadingTCPServer((‘192.168.1.6‘,8002),MyServer) print(123) print(s.socket) s.serve_forever() print(456)
标签:开发 font socket 客户 ase hid _for self mys
原文地址:https://www.cnblogs.com/jintian/p/10976884.html