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

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -