timeoutsocket - not blocking on connect?

Discussion in 'Python' started by Raja, Feb 13, 2004.

  1. Raja

    Raja Guest

    Hello
    Im trying to catch timeouts from a socket and my code looks like
    try:
    timeoutsocket.setDefaultSocketTimeout(10)
    s = timeoutsocket.timeoutsocket(timeoutsocket.AF_INET,
    timeoutsocket.SOCK_STREAM)
    print s.get_timeout()
    s.connect(("localhost", 80))
    except timeoutsocket.Timeout:
    print 'Timeout'

    I do give a SIGSTOP on my webserver so that all the requests hang and
    i have created a timeout situation.(When i connect to
    http://localhost, it hangs).

    I looked at timeoutsocket.py and it looks like the connect() does call
    socket.connect and then does a select.select using the sock. In my
    case, it does have the write file descriptors not blocking and so it
    does return back. Shouldnt it just return a timeout for the above
    case? The documentation on timeoutsocket.py mentions that if the
    timeout needs to be captured on connect(), u shud use the
    setdefaultsockettimeout.


    Im a newbieee so go easy on me. Please let me know if you need any
    more info.

    TIA
    Raj
    Raja, Feb 13, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hendra Gunawan
    Replies:
    1
    Views:
    12,532
    Allan Herriman
    Apr 8, 2004
  2. Larry
    Replies:
    0
    Views:
    371
    Larry
    Sep 16, 2003
  3. Gilles Lenfant

    timeoutsocket.py

    Gilles Lenfant, Oct 31, 2003, in forum: Python
    Replies:
    8
    Views:
    530
    Gilles Lenfant
    Nov 4, 2003
  4. Replies:
    4
    Views:
    317
  5. Ed W
    Replies:
    2
    Views:
    333
Loading...

Share This Page