时间:2020-12-18 02:26:14 | 栏目:Python代码 | 点击:次
python写法
import socket def test_socket_timeout(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print "Default socket timeout: %s" %s.gettimeout() s.settimeout(100) print "Current socket timeout: %s" %s.gettimeout() if __name__ == '__main__': #针对单个socket实例的超时 test_socket_timeout()