Binding a QTcpSocket on a dual core host
I have an application that is being built using Qt. It will work on machines that have two (or more) network cards. I need my application to choose which Ethernet interfaces to use for the TCP connection. Before anyone suggests it, I cannot guarantee that the routing tables will be configured correctly. I know how to do this using the windows socket classes, but couldn't find anything about it for Qt. Any help would be greatly appreciated!
source to share
Do you mean outgoing connection or incoming connection?
If you are referencing an inbound connection, all you have to do is tell the QHostAddress to call QTcpServer :: listen .
If you're talking about an outbound connection, you can call QAbstractSocket :: setLocalAddress to force the local address to do something specific.
Greetings,
source to share
If you are using Qt 4.2 or newer, you can use QNetworkInterface to get a list of network interfaces on the computer and then create some network interface.
source to share