[Interest] QUdpSocket, QNetworkDatagram and QNetworkInterface
nunosantos at imaginando.pt
Tue Oct 29 20:12:37 CET 2019
I’m trying to understand how does Qt decides which QNetworkInterface will be used when a writeDatagram is called.
I’m currently on a system that has both cable and wifi connections available, however, when doing a QUdpSocket writeDatagram the packets are being sent from the wifi adaptor, at least this is what I can infer from the IP address that comes on the packet when it arrives the other machine. What puzzles me is that supposedly, a cable connection is faster than a wifi connection.
While investigating the Qt documentation, it seems that I can use the writeDatagram function of QUdpSocket and specify on the QNetworkDatagram which interface I want to use by using the setInterfaceIndex function.
Is there anyway of knowing which network interface will be used by a QUdpSocket when transmitting data via writeDatagram? Or should I explicitly setInterfaceIndex on QNetworkDatagram and use the writeDatagram QNetworkDatagram variant function in order to have full control?
More information about the Interest