QUdpSocket can't receive data from specific interface
-
Hi all,
I am trying to receive data from a hardware device using a UDPSocket.
I have successfully connected to port via UDPSocket->bindif( socket->bind(QHostAddress("192.168.250.151"), port )
but the data not coming.
When I opened WireShark and select the Ethernet adapter the data receive successfully.
Another words UDP data from device receiving only when WireShark is open.
Mayby I need to specify Ethernet adapter to the port...
Any ideas? Thanks.
-
Hi all,
I am trying to receive data from a hardware device using a UDPSocket.
I have successfully connected to port via UDPSocket->bindif( socket->bind(QHostAddress("192.168.250.151"), port )
but the data not coming.
When I opened WireShark and select the Ethernet adapter the data receive successfully.
Another words UDP data from device receiving only when WireShark is open.
Mayby I need to specify Ethernet adapter to the port...
Any ideas? Thanks.
Ist the port correct, does your host really have the ip address 192.168.250.151? Do you have correctly configured the firewall (esp. on windows this is a common problem).
-
Firewall and antivirus is turned off.
I wrote local IP address and the port manually, but nothing changed.if( socket->bind(QHostAddress("192.168.250.151"), 52100 ) ) { qDebug() << "PASS, Port Num : is connected"; } else { qDebug() << "FAIL connected to UDP"; }
It is really strange behavior.
-
Firewall and antivirus is turned off.
I wrote local IP address and the port manually, but nothing changed.if( socket->bind(QHostAddress("192.168.250.151"), 52100 ) ) { qDebug() << "PASS, Port Num : is connected"; } else { qDebug() << "FAIL connected to UDP"; }
It is really strange behavior.
I'm pretty sure it's the windows firewall. Try to send to a dedicated adress instead broadcast to see if it helps but QUdpSocket can handle both correctly. See also the examples and try them out: https://doc.qt.io/qt-6/qudpsocket.html#details