Re: Why unplugging network cable not cause TCP state change?
Re: Why unplugging network cable not cause TCP state change?
- Subject: Re: Why unplugging network cable not cause TCP state change?
- From: Jens Alfke <email@hidden>
- Date: Tue, 26 Apr 2016 09:52:11 -0700
The problem here is: why unplugging network cable not change the socket's TCP state sometimes?
That’s normal, correct behavior for TCP. The current state of an interface doesn’t matter, except when packets are sent. What disconnects a TCP socket is when it sends a packet but never receives an ACK, or when the remote host sends a FIN packet.
If you want a socket to disconnect quickly when an interface goes down, you’ll need to either (a) monitor the state of that interface and close the socket yourself (the SystemConfiguration framework provides notifications for that) or (b) periodically send no-op data on the socket to test whether the remote peer is still reachable and up.
—Jens
PS: The macnetworkprog mailing list is a better place to discuss Mac/iOS networking issues. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden