|
Boost : |
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2019-06-27 14:07:03
On 6/25/19 8:43 AM, JH via Boost wrote:
> Hi,
>
> I have an application using ASIO TCP/IP SSL socket connection in an
> embedded device, the device has two network interfaces, when one is
> down, another network interface takes over, which requires application
> TCP SSL socket connection to be established binding to a new network
> interface. What will be an appropriate implementation to switch
> application TCP connection from one to another interface?
>
> Option 1: Restart application
>
> Option 2: Terminate the old interface socket, create a new socket to
> start initial connection
>
> Option 3: Some reconnection method which I don't know
With plain TCP and two distinct network interfaces, I don't think there
is a way except to re-establish TCP/TLS connection when you detect that
the previous connection died. Which you should detect as soon as you try
sending something. This is the reason why most of the time you need some
sort of periodic keepalive exchange with the server.
Other than that, you may look into more advanced network configurations,
like interface bonding, for example. Your application will open the
connection on the bond interface and then the OS will decide which lower
level interface to use to send data. I haven't done that, but as I
understand it, it should work more or less transparently to your
application.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk