Udp send and receive problem
Hello friends,
I have a problem.
I am using Qt Windows 5.12.6 Mingw 32 and 64 bit. First I send a message to brodcast address 255.255.255.255 using udp protocol. I send this message from other client devices I check and send different packages to the device I started broadcasting in return. I have this problem. The system is working properly when I make the program listening with Wireshark in the background. So I can send and receive packages. However, after I leave the network adapter that I selected in wireshark or when wireshark is off, my program stops sending and receiving packets.
I gave full authorization to both programs I tested on the firewall. But I couldn't solve this problem. I'm also packing this problem with windeployqt after compiling it as release or debug. Although I authorize this program from the firewall and run it as an administrator, I cannot send or receive any packages. Have you ever experienced a similar error? If there is how it is solved. Thank you very much in advance.
Happy codings,
Re: Udp send and receive problem
Please give more details about your setup:
Are both the broadcasting machine (lets call it client) and the machine expected to reply (lets call it server) running your Qt based program? All Windows10 machines?
On which machine do you run wireshark?
The firewall you are talking about is the Windows firewall / Defender, right?
Are you sure that the client machine stops sending the broadcast? Maybe there is some other problem, like blocked "Unicast responses to multicast broadcasts" on the server, see e.g. https://docs.microsoft.com/en-us/win...icastbroadcast
Re: Udp send and receive problem
Quote:
Originally Posted by
stryga42
Please give more details about your setup:
Are both the broadcasting machine (lets call it client) and the machine expected to reply (lets call it server) running your Qt based program? All Windows10 machines?
On which machine do you run wireshark?
The firewall you are talking about is the Windows firewall / Defender, right?
Are you sure that the client machine stops sending the broadcast? Maybe there is some other problem, like blocked "Unicast responses to multicast broadcasts" on the server, see e.g.
https://docs.microsoft.com/en-us/win...icastbroadcast
Server program and client program are available. The server is throwing a data with a broadcast signature. For example: 25AA4B. After this message, the client programs listen to the broadcast continuously and when this signature arrives, they add their information behind this signature and throw it back to me. When I run Wireshark on the client device, I receive the sent packet. The data exchange is interrupted when Wiresh turns the song off. I mentioned the firewall windows defender yes. I allowed both the port I used and authorized the application. His work in connection with Wireshark makes me think a lot. Thank you
Re: Udp send and receive problem
Folks,
The problem still continues. Does anyone have an idea ? I wonder if when I run a program running over wireshark or another ethernet, the reason for the packets to come and go may be related to a library that program uses. For example, could wireshark include sys / socket.h and start listening to that controller? I'm going crazy.
Re: Udp send and receive problem
Hi, have you tried to temporarily disable the firewall completely?
Ginsengelf
Re: Udp send and receive problem
Quote:
Originally Posted by
Ginsengelf
Hi, have you tried to temporarily disable the firewall completely?
Ginsengelf
Yes. I tried firewall. Still failing.
I think I solved the problem. I flushed the pointer after writing or reading the datagram to the socket object I created. Then I noticed that the error was resolved. I wonder why?
Code:
.
..
...
socket->writeDatagram(......);
socket->flush(); < fix it
Re: Udp send and receive problem
Without being able to see your code we can only guess. My guess is that your code does not return to the Qt event loop. To quote the docs, "In most cases, you do not need to call this function, because QAbstractSocket will start sending data automatically once control goes back to the event loop."