Re: Sockets and Network Disconnect?
Re: Sockets and Network Disconnect?
- Subject: Re: Sockets and Network Disconnect?
- From: Josh Graessley <email@hidden>
- Date: Thu, 31 Jul 2008 12:36:46 -0700
In general, you really should use asynchronous calls when dealing with
the network. Things can go wrong and you don't want to block.
-josh
On Jul 31, 2008, at 12:27 PM, Karl Moskowski wrote:
I'm writing a Leopard-only application that communicates with a
server using a custom protocol, basically sending & receiving a
sequence of TCP packets. I had tried using AsyncSocket, and it was
great, but its delegation-based approach made handling certain
situations too complex. I rewrote things to use SmallSockets in a
NSOperation, and it's been great. Now I'm trying to handle some
errors, such as when the network connection drops (e.g., cable
disconnect, AirPort out of range).
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. In each case, the result was a
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?
Thanks.
----
Karl Moskowski <email@hidden>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
_______________________________________________
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