timeoutsocket - not blocking on connect?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Raja

    timeoutsocket - not blocking on connect?

    Hello
    Im trying to catch timeouts from a socket and my code looks like
    try:
    timeoutsocket.s etDefaultSocket Timeout(10)
    s = timeoutsocket.t imeoutsocket(ti meoutsocket.AF_ INET,
    timeoutsocket.S OCK_STREAM)
    print s.get_timeout()
    s.connect(("loc alhost", 80))
    except timeoutsocket.T imeout:
    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.p y 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.p y mentions that if the
    timeout needs to be captured on connect(), u shud use the
    setdefaultsocke ttimeout.


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

    TIA
    Raj
Working...