Boost logo

Boost :

From: Boris (boris_at_[hidden])
Date: 2019-08-03 13:10:53


On 2019-08-03 1:10 PM, JH via Boost wrote:
> Hi,
>
> I have been using asio tcp socket on desktop Ubuntu for years, but I
> have never seriously run interface connections in a LTE embedded
> system, here is what I have observed wired thing:
>
> - Client initialized TCP socket connection to remote server, the
> connection was established.
>
> - Client sent data to server via Internet every one minute, all good.
>
> - Somehow, the LTE connection dropped, there was no any network
> connection available, but the client keep sent messages, there was no
> error about the network connection, the message obvious could not go
> Internet, it accumulated in the RAM, the original each message size
> was 79 bytes, the size was accumulated became 52790 bytes, it kept
> going for ever until I terminate the client program.
> .......
> Send message size: 52790
> Send message size: 52869
> Send message size: 52948
> .....
>
> Is it normal behavior of ASIO socket or what I did wrong here?
> Appreciate your insight tips to fix this problem to trig client socket
> error not keeping sending message going no way.
>
> Thank you.
>
> Kind regards,
>
> - jupiter
>
This is pretty much how cell networks behave, the system itself is never
really sure if the connection is truly down or just momentarily disrupted.

What you can do is notice the timestamp of last incoming packet (perhaps
using keep-alive packets) and then decide that the network is "down"
when you haven't received a packet in a particular period of time.

-- 
Scapix Language Bridge
Automatically generated C++ bindings for|Java|,|Objective-C|,|Swift|,|Python and ||JavaScript (Emscripten)|
https://www.scapix.com
https://github.com/scapix-com/scapix

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk