|
Boost Users : |
Subject: Re: [Boost-users] Why cannot asio tcp socket server detect TCP disconnection when the client device lost power?
From: niXman (i.nixman_at_[hidden])
Date: 2017-06-29 12:51:07
jupiter via Boost-users 2017-06-29 15:41:
Hi,
> 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.
You should inherit the enable_shared_from_this<your session class>, and
in async ops in your session class you should use shared_from_this()
when start async ops.
For monitoring your session you should use map/any_container with
weak_ptrs, not shared_ptrs.
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows: https://sf.net/p/mingw-w64/
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