• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sockets and Network Disconnect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Sockets and Network Disconnect? (From: Karl Moskowski <email@hidden>)

  • Prev by Date: Sockets and Network Disconnect?
  • Next by Date: Re: Sockets and Network Disconnect?
  • Previous by thread: Sockets and Network Disconnect?
  • Next by thread: Re: Sockets and Network Disconnect?
  • Index(es):
    • Date
    • Thread