Non blocking sockets with select.poll() ?

Discussion in 'Python' started by Maxim Veksler, May 4, 2007.

  1. 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.bind(('', 10000))

    __poll = select.poll()

    print "I did not block"
    Maxim Veksler, May 4, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.