[Haskell-cafe] controlling timeout for Network.Socket.connect - how?

Manlio Perillo manlio_perillo at libero.it
Tue Feb 24 13:07:46 EST 2009


Belka ha scritto:
> Hello, communion people!
> 
> I have a problem and ask for an advice. 
> I'm dealing with sockets on *Linux* platform (Network.Socket). The problem
> is that I can't fully control timeout for (connect :: Socket -> SockAddr ->
> IO ()) operation. 
> On my system the timeout is - 3 seconds - 

What system?
Is the timeout the same with a plain C program?

connect timeout is typically 75 seconds.

Also note that system timeout is only used when the socket is in 
blocking mode.

 > [...]
> I know that controlling timeout is somehow connected to select(2) 

Yes.
The only working method is to set the socket to non blocking mode, and 
use select (or poll/epoll/kqueue).


 > [...]


Manlio Perillo


More information about the Haskell-Cafe mailing list