python sockets how to not queue connection requests -
this code have:
sock = socket.socket(socket.af_inet,socket.sock_stream) sock.setblocking(0) sock.setsockopt(socket.sol_socket,socket.so_reuseaddr,1) sock.bind(('localhost',self._lp)) sock.listen(0)
for listen(), have tried 0 , 1 in both cases once 1 client connects, future clients hang until first connects. additional clients attempt connect fail instead of waiting. presently, thing can think of periodically check sock , close queued connections. there better way?
thanks
this might sound trivial, but: close listening socket -- stop listening!
sock.close()
Comments
Post a Comment