how do I use select to timeout a call to accept?

Joshua Muskovitz josh at
Thu Nov 9 07:32:40 CET 2000

I have the line...

        (clientsocket, address) = mylisteningsocket.accept()

...and this blocks until a connection comes in.  I want to be able to have
this timeout periodically so I can check some other things.  Before anyone
suggests using threads, it is already in its own thread.  What it needs to
check is whether it is no longer needed and should kill itself...

Basically, I want to be able to do something like:

        <magic which either accepts a connection or times out>
        clientsocket, address = <more magic>
    except <it was a timeout>:

I read (somewhere) that select can be used with accept (and connect and a
bunch of other things), but I can't find any examples of how to do it.

-- josh

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

More information about the Python-list mailing list