Reputation: 25
We are using Delphi Berlin 10.2
We have an application that runs on devices with 2 or more ethernet adapters. It's mandatory for us to choose a specific network adapter.
I researched and failed to find a way to do this using Indy, Synapse, or even Winsock.
The connect methods don't offer this option, they offer only destination IP and port.
Is there a way to do this?
Upvotes: 3
Views: 1308
Reputation: 597971
You need to bind()
the client socket to the local IP address of the desired network interface, then connect()
will reach out to the server's IP:port using the network that the interface is attached to.
Indy has properties for that purpose, for instance the BoundIP
property of TIdTCPClient
.
I'm sure Synapse (and most other networking libraries) has its own equivalent for this, too.
Upvotes: 7