Boost logo

Boost Users :

Subject: Re: [Boost-users] Why cannot asio tcp socket server detect TCP disconnection when the client device lost power?
From: jupiter (jupiter.hce_at_[hidden])
Date: 2017-06-29 12:41:39


On Thu, Jun 29, 2017 at 5:50 PM, Eric Prud'hommeaux <eric_at_[hidden]> wrote:

> > Tearing down a connection involves specific signalling on the TCP layer
> > (FIN,RST).
> >
> > Now imagine your situation:
> > You have two machines, and both have a TCP connection to each other.
> > When the TCP connection is idle (i.e. nothing is sent between the two)
> there
> > won't be any signalling on the TCP layer
> > if TCP keep-alive is disabled and there is no application layer heartbeat
> > mechanism.
>
> Implied but not stated here: a TCP keep-alive would be sufficient to
> notify a server about a client falling off the net, though you may
> have other reasons to want your own heartbeat messages.
>
>
I have a connection map in my server as part of monitoring system to trace
down the client connections. If the server can be notified by kernel for a
client falling off, that will be
good to use a callback errorHandler to clean up the socket connection as
well as the connection map automatically.

Bandwidth usage is another restriction in my application as the small
devices connect by 3G / LTE, anyone knows what is the extra package size
for using boost keep alive option?

If I have to use heartbeat in user level, I also need deploy a timer /
polling mechanism in the server to check missing heartbeat messages then
clear the connection and connection map. I don't mind if a client is in
idle, but the monitoring system need to detect if a client is connected or
not. I don't feel understanding boost socket keepalive option well, I need
to explore the boost socket keepalive option more.



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