I have following task, would you suggest, whether (and how if yes) it is possible to solve it:
A computer has 2 LAN adapters; each one is connected to different network provider.
Some information must be sent via first one and some information via second one.
Is it possible somehow to specify which adapter to use by initialization of a connection?
In Java you can use the
NetworkInterfaceclass, in conjunction withSocket.bind()to specify what interface to bind to.Example, taken from this reference:
Then by setting up two sockets, one per interface you can use both simultaneously.
The other way to solve this problem though is with interface bonding, which is a configuration issue (e.g. on Linux) and presents two physical interfaces as one virtual interface. (Bonding is the exact opposite of specifying which interface to use when creating a socket, but isn’t a programming issue though)