[Workaround]Strange udp socket when interchanging messages between Linux and Windows Box
-
Hi
+1 for good problem description.That is really strange.
(stupid question)
And its not just Linux \n, Windows \r\n. line endings so it
never considered fully read when mixing OSes. ?And both Qt on win/linux is same version so its not something there?
-
Both QT versions are 5.5.
\n and \r\n is not used, only \t to have a field separator. BTW: the application that sends the broadcast message only send "AutodetectRequest" without any line ending characters. And this mesage is received by application B.
Nevertheless I tried your suggestion and add \n and \r\n to the answer, but this does not change anything. -
@vman
Hmm.
And since you already have used WireShark, im kinda out of ideas for now.It cannot be linux firewall as that would also block linux <->linux, I assume.
maybe try something like netcat
https://eternallybored.org/misc/netcat/to see if other apps can do cross udp ?
-
Hi mrjj,
I'm now sure it has something to do with the broadcast message. I modified application B a little bit and add a push button that sends exactly the same message that is sent as answer to the broadcast. And, surprisingly, this message is received by application A.
Just to make clear what happens.
I bind the udp socket on app A this way:
socket->bind(40102);
If I send messages from the Linux box to the Windows Box, these messages are received.Then I send a broadcast message from app A to app B using
socket->writeDatagram(buffer, QHostAddress::Broadcast, 40102);
From now on, neither the answer message from app B nor the message that was sent by push button from app B is received any more.
So it seems that sending the broadcast message blocks the port for receiving. -
Well, to be precise, sending the broadcast message seems to prevent the socket from receiving messages from the Linux box. If the second app runs on windows then everything works as expected. So I'm still not 100% sure that the problem is in App A (the broadcasting app). It could be on app B as well.
-
and we 100% rule out both build-in firewalls ?
I think yes, otherwise I would not see the udp messages in wireshark.
AND
if I replace
socket->writeDatagram(buffer, QHostAddress::Broadcast, 40102);
withQHostAddress ip; ip.setAddress("192.168.1.7") // The IP of the box running App B socket->writeDatagram(buffer, ip, 40102);
then it works correct. But as soon as I send a broadcast message app A can not receive any packages (again, only the the answer comes from a Linux box, the problem disappears if both are windows or both are linux)
-
OK, I use two sockets now.
On App A I have one socket for sending the broadcast message, and a second one on another port for receiving the answer.
Same on App B. One socket for receiving the broadcast message and a second one for sending the answer on a different port.Still would be very happy if someone can find a solution for this using only one udp socket.