|
Boost Users : |
Subject: Re: [Boost-users] Linux TCP session stays ESTABLISHED when interface is removed
From: Chris Verges (cverges_at_[hidden])
Date: 2013-09-25 20:21:44
On Thu, Sep 26, 2013 at 11:40:56AM +1200, Gavin Lambert wrote:
> On 9/26/2013 9:36 AM, Quoth Chris Verges:
> >However, if I physically remove the network interface -- such as yanking
> >the USB adapter out of its socket -- the TCP session stills reports as
> >ESTABLISHED via netstat and the application receives no read error.
> >
> >I'm at a bit of a loss how this is possible when the underlying OS shows
> >that the interface no longer exists yet the socket is blocking away
> >happily. Has anyone else experienced similar symptoms? Any advice?
>
> This is normal for TCP connections. If you only have outstanding
> read operations you cannot detect non-graceful shutdowns.
Thanks for the quick reply and insight. I'm floored that the physical
interface and/or IP address being removed from the system doesn't cause
a related-socket closing. I now understand that this type of
functionality is more of a kernel mod than a Boost one.
> However the next time you attempt to write to the socket you will
> get a disconnection error.
Having a "null message" (nop, heartbeat, whatever) should do what is
desired, agreed. However, the link is a pay-per-byte thing. I'd prefer
to not pay for null. :-)
Do you happen to know if writing a zero-length message would be enough
to trigger the socket layers to reset without forcing data across the
physical layer? (I'm in the middle of coding it up as a test, but
figured I'd ask just in case you happened to know.)
Much appreciation for your reply,
Chris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net