python小程序之并发连接

 import threading
import socket
import time
def conn():
cli = socket.socket()
cli.connect(("58.68.232.139",80))
while True:
data = input(">>>").strip()
if len(data) == 0:continue
cli.send(data.encode())
reciv = cli.recv(1024)
print(reciv)
for i in range(2000):
t =threading.Thread(target=conn)
t.setDaemon(True)
t.start()
time.sleep(15)
print("--main--")
上一篇:Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试


下一篇:2020口碑评分超高的蓝牙耳机,圣诞送礼高颜值蓝牙耳机让她爱不释手