我有以下课程:
from socket import *
import select
class UdpListenerPort:
def __init__(self, socket):
self.socket = socket
self.socket.setblocking(0)
def get_data_to_dispatch(self):
is_ready = select.select([self.socket],[],[],0.01)
if is_ready[0]:
return self.socket.recvfrom(0xffff)[0]
else:
return None
它从一个线程内运行。当我退出线程时,出现以下异常:
return self.socket.recvfrom(0xffff)[0]
socket.error: [Errno 10038] An operation was attempted on something that is not a socket
我怎样才能避免这种情况,
谢谢,
巴里