Non blocking sockets with select.poll() ?

M

Maxim Veksler

Hi,

I'm trying to write a non blocking socket port listener based on
poll() because select is limited to 1024 fd.

Here is the code, it never gets to "I did not block" until I do a
telnet connection to port 10000.

"""
#!/usr/bin/env python
import socket
import select

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(0)
s.bind(('0.0.0.0', 10000))
s.listen(5)

__poll = select.poll()
__poll.register(s)
__poll.poll()

print "I did not block"
"""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top