Re: Sockets and Network Disconnect?
Re: Sockets and Network Disconnect?
- Subject: Re: Sockets and Network Disconnect?
- From: Mark Pauley <email@hidden>
- Date: Thu, 31 Jul 2008 14:19:11 -0700
In general, using CFNetwork and NSURL is probably going to be MUCH
easier for you if you want "nice" behavior of this sort. We already
monitor SCNetwork Reachability events and will tell you well before
the 60 second socket timeout. If you want to get around this, you're
going to be rolling your own asynchronous operation stack anyhow ontop
of select...
_Mark
On Jul 31, 2008, at 1:30 PM, Jens Alfke wrote:
On 31 Jul '08, at 12:27 PM, Karl Moskowski wrote:
SmallSockets seems to hang on send() & recv() without an error.
After Googling around, I tried a couple of approaches to test
network reachability first - SCNetworkCheckReachabilityByAddress()
and CFNetDiagnosticCopyNetworkStatusPassively() - but neither
seemed to work.
...
Is there a way to get SmallSockets to time-out or throw some sort
of error in such a situation? If not, is there another synchronous
socket class?
I'm not familiar with SmallSockets, but there are general-purpose
techniques to implement timeouts or other disconnects when using
POSIX socket APIs, usually involving using an alarm or signal.
Stevens et al's "Unix Network Programming" covers these. (I can't
give you details, because I don't code this way; I use the async
APIs provided by CFNetwork and Foundation.)
—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden