469,292 Members | 1,349 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

Non blocking sockets with select.poll() ?

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"
"""

--
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?
May 4 '07 #1
0 1574

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tero Saarni | last post: by
2 posts views Thread by J. Xu | last post: by
11 posts views Thread by Michi Henning | last post: by
1 post views Thread by opi | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.