Re: Re(2): bsd sockets & http
Re: Re(2): bsd sockets & http
- Subject: Re: Re(2): bsd sockets & http
- From: Peter Sichel <email@hidden>
- Date: Mon, 22 Jul 2002 14:04:04 -0400
At 10:13 AM -0700 7/22/02, Becky Willrich wrote:
I have another question about the behavior of sockets, though.
When I try to connect() to a host that doesn't exist, connect()
will return an error after one or two minutes, while the beach ball
spins. Is there a way to shorten that time?
Sadly, no; the actual timeout is (I think) 75 seconds, and you
cannot get the connect to timeout before that. You can call the
connect non-blocking, then poll the socket for writability (simply
closing it if you don't want to wait any longer); that's your best
option, but now you won't block in connect() at all.
You don't literally need to poll, use select instead. Stevens Unix
Network Programming has an example showing how to connect with time out.
- Peter
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.