Why connections drop when the network changes
A TCP connection is identified by the IP addresses and ports of its two endpoints. When a device switches from Wi-Fi to mobile data, it gets a new IP address, so the existing connection becomes unusable and eventually times out. The application sees an error or a hang and has to reconnect. Any state that was associated with the connection, such as a login session or a transfer in progress, is lost.
There are several ways to deal with this. You can implement reconnect logic in your application, but it must detect the failure, resume the session and handle data that was in flight when the connection broke. Multipath TCP solves the problem in the kernel, but requires support from both operating systems and must be let through by the middleboxes on the path. QUIC supports connection migration, but requires your application to use QUIC and only helps with address changes, not with using several networks at the same time.
How Aggligator handles it
Aggligator separates the logical connection from the network links that carry it. Each link is an ordinary transport connection, for example TCP, TLS, a WebSocket, USB or Bluetooth. Links can fail, return, be added or be removed while the logical connection runs. Data that a failed link did not deliver is resent over the remaining links.
While Wi-Fi and mobile data are both available, both carry data and the connection has their combined bandwidth. When the device leaves Wi-Fi coverage, the Wi-Fi link fails and traffic continues over mobile data alone; the handover needs no involvement from the application. If all links are gone, the connection is kept open for a configurable time while the transport connectors keep trying to establish a new link. A link that comes back, possibly from a new IP address or a different network, authenticates itself to the existing connection and traffic resumes where it stopped. For the application this roaming between networks is seamless; it just keeps reading and writing its one stream.
All of this happens in user space, without any support from the operating system or the network in between.
From Rust, it is a socket
The TCP transport discovers the usable routes between the two hosts and maintains a link over each of them. Your application reads and writes one stream.
use aggligator_transport_tcp::simple::tcp_connect;
use tokio::io::AsyncWriteExt;
// One stream over all interfaces: Wi-Fi, mobile data, Ethernet.
let mut stream = tcp_connect(["server"], 5900).await?;
stream.write_all(b"hello").await?;
If your application is not written in Rust, you can use
agg-tunnel to tunnel existing
TCP applications →
Questions
Does this need Multipath TCP or support from the operating system?
No. Aggligator is completely implemented in user space and works over ordinary transports such as TCP, TLS or WebSockets. It serves the same purpose as Multipath TCP, but neither the operating system nor the network in between needs to know about it.
Does the connection survive an IP address change?
Yes. A new link authenticates itself to the existing connection using a secret that was established when the connection was opened. It can therefore attach from any address and the logical connection continues unchanged.
What happens while no network is available at all?
The logical connection is kept open for a configurable time while the transport connectors keep trying to establish a new link. The application's stream stalls during that time and resumes when a link becomes available again. No data is lost.
Can I use this with an existing application without changing its code?
Yes. The agg-tunnel utility runs on both machines and forwards ordinary TCP ports over an aggregated connection. The client and server applications do not need to be modified.
Do both ends have to run Aggligator?
Yes. Aggregation happens between the two endpoints of the connection, so the server side must run Aggligator or agg-tunnel as well. Connections to third-party services that you do not control cannot be made to survive a network change.
Where to go next
The Aggligator overview shows how data is distributed over unequal links and which transports are available. If you want to combine links for bandwidth rather than resiliency, see combining multiple internet connections.