Sometimes,you need to manipulate the default values of certain properties of a socket library, for example, the socket timeout. 设定并获取默认的套接字超时时间. 1.代码 import socket def test_socket_timeout(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print
本地套接字简单应用场景 一 #服务端--简单 import socket import os a='sock_file' if os.path.exists(a): os.remove(a) s=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM) s.bind(a) s.listen(3) while True: c,addr = s.accept() while True: date=c.recv(1024) if not date: c.clos