草庐IT

respuesta

全部标签

python - 如何重用 TCP 套接字 python

我想做什么我想用不同的IP和PORT再次使用sTCP.connect()我的问题在while的下一个交互中(当我有一个与上一个不同的IP和PORT时),我得到一个错误:“这个连接已经在使用中”我该怎么做才能让它发挥作用?套接字在while循环之前声明。为了清楚起见,我将只显示while循环:whiley!=numero_de_lineas:print"Interaccionnumero",yifreintentar==1:printyreintentar=0tupla=(str(iplista[y]),int(portlista[y]))sUDP.sendto(mensaje1,tup