Re: Detecting cable unplug/Network failure
Re: Detecting cable unplug/Network failure
- Subject: Re: Detecting cable unplug/Network failure
- From: Jens Alfke <email@hidden>
- Date: Mon, 2 Mar 2009 11:22:25 -0800
On Mar 2, 2009, at 9:27 AM, David García wrote:
I'm quite new in Mac programming, and I've found some problems where
I got stuck in the network. The matter is that, I need to know when
there's a physical network error (most immediate cable being
unplugged).
The SystemConfiguration framework will let you register for various
notifications. The one you probably want is for when the
"reachability" of a specific IP address changes. I don't remember the
name of the function, but it's pretty clear which one it is (and there
is sample code for it.)
When I perform writes to the socket, the OS seems to take bytes
without problem (saving them into internal buffers I imagine), but
doesn't return an error.
This is by design. TCP is resilient to temporary connectivity
problems, and will buffer up data and attempt to resend it several
times before giving up. This is useful if your 3G connection goes down
for a few seconds, or your DSL modem has to resync, or you have to
swap out an Ethernet cable to a server, etc.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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