QUdpSocket does not trigger ReadyRead signal
-
Hi,
Are you trying to send and receive the image using the exact same socket ?
-
Then show what you are doing.
From what you wrote, you don't even have an event loop running hence not signals/slots working.
Also, why are you trying to use UPD to send data from your application back to the same application ?
-
Then show what you are doing.
From what you wrote, you don't even have an event loop running hence not signals/slots working.
Also, why are you trying to use UPD to send data from your application back to the same application ?
@SGaist I already posted almost all of my code? What do you mean "show what you are doing?"
I am sending/recieving on same PC to test if I can so later I can implement it for different PC's. Since Im newbie I dont know much about event loops can you show some example? -
@SGaist I already posted almost all of my code? What do you mean "show what you are doing?"
I am sending/recieving on same PC to test if I can so later I can implement it for different PC's. Since Im newbie I dont know much about event loops can you show some example?@onurcevik Can you show your main.cpp?
-
@onurcevik Can you show your main.cpp?
-
@onurcevik A loop with sleep() inside (before starting event loop) and you expect this to work? It will not. See what @SGaist wrote.
-
@onurcevik A loop with sleep() inside (before starting event loop) and you expect this to work? It will not. See what @SGaist wrote.
-
return a.exec();
this starts the event loop. No need for threads. Use asynchronous nature of QUdpSocket instead. You should take a look at one of the example applications for networking.
-
return a.exec();
this starts the event loop. No need for threads. Use asynchronous nature of QUdpSocket instead. You should take a look at one of the example applications for networking.
@jsulm I deleted sleep and for loop it still did not work. I did take a look couple of examples even tried to run it. A pinpoint to what wrongs with my code would be really helpful. Since removing sleep and for did not work either.
Edit: I will switch to QWidget application and try to send through a button click.
-
@jsulm I deleted sleep and for loop it still did not work. I did take a look couple of examples even tried to run it. A pinpoint to what wrongs with my code would be really helpful. Since removing sleep and for did not work either.
Edit: I will switch to QWidget application and try to send through a button click.
Hi @onurcevik,
- On which platform are you?
- Which Qt version do you use?
- Do you have multiple network adapters in your computer?
Regards
-
Hi @onurcevik,
- On which platform are you?
- Which Qt version do you use?
- Do you have multiple network adapters in your computer?
Regards
-
- I am on Kubuntu
- I use Qt Creator 4.6.2 Based on Qt 5.11.1 (GCC 8.1.0, 64 bit)
- I only have 1 modem.
Can you please post the output of
ifconfig -a
?It is likely that your packet is not even send out. You can check that with Wireshark.
Edit:
I use Qt Creator 4.6.2 Based on Qt 5.11.1 (GCC 8.1.0, 64 bit)
That is the Creator version, not the Qt version I asked for.
-
Can you please post the output of
ifconfig -a
?It is likely that your packet is not even send out. You can check that with Wireshark.
Edit:
I use Qt Creator 4.6.2 Based on Qt 5.11.1 (GCC 8.1.0, 64 bit)
That is the Creator version, not the Qt version I asked for.
That is the Creator version, not the Qt version I asked for.
I use Qt Creator 4.6.2 Based on Qt 5.11.1 (GCC 8.1.0, 64 bit)
QT version is next to the QT Creator Version which is 5.11.1
the output of ifconfig -a :
enp27s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.2.44 netmask 255.255.255.0 broadcast 192.168.2.255 inet6 fe80::a98d:26da:2afd:3299 prefixlen 64 scopeid 0x20<link> ether 00:d8:61:15:7d:b8 txqueuelen 1000 (Ethernet) RX packets 37659 bytes 41459688 (41.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 27301 bytes 2684010 (2.6 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 1963 bytes 180145 (180.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1963 bytes 180145 (180.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@aha_1980 said in QUdpSocket does not trigger ReadyRead signal:
-
That is the Creator version, not the Qt version I asked for.
I use Qt Creator 4.6.2 Based on Qt 5.11.1 (GCC 8.1.0, 64 bit)
QT version is next to the QT Creator Version which is 5.11.1
the output of ifconfig -a :
enp27s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.2.44 netmask 255.255.255.0 broadcast 192.168.2.255 inet6 fe80::a98d:26da:2afd:3299 prefixlen 64 scopeid 0x20<link> ether 00:d8:61:15:7d:b8 txqueuelen 1000 (Ethernet) RX packets 37659 bytes 41459688 (41.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 27301 bytes 2684010 (2.6 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 1963 bytes 180145 (180.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1963 bytes 180145 (180.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@aha_1980 said in QUdpSocket does not trigger ReadyRead signal:
@onurcevik said in QUdpSocket does not trigger ReadyRead signal:
QT version is next to the QT Creator Version which is 5.11.1
That is the Qt version Creator is built with, which is not necessarily the version you are using to compile your program.
From you ifconfig I see, that there is only one physical interface., so bind should select the correct one.
Please check with wireshark that the packet is sent out.
-
Just for the sake of simplification, did you take a look at the examples linked in the QUdpSocket documentation ?
Thinking about:
Broadcast Sender
Broadcast Receiver
Multicast Sender
Multicast Receiver -
@onurcevik said in QUdpSocket does not trigger ReadyRead signal:
QT version is next to the QT Creator Version which is 5.11.1
That is the Qt version Creator is built with, which is not necessarily the version you are using to compile your program.
From you ifconfig I see, that there is only one physical interface., so bind should select the correct one.
Please check with wireshark that the packet is sent out.
-
What exactly is the goal of your application ?
-
@SGaist I want to take pictures from camera then send and recieve them continuously in order to implement a real time video streaming application. The reason I am sending images instead of video is because I will later work on image processing. I realized that image size is too big for this which is 6404803 BYTES. But I also can't switch to TCP because I need the speed of UDP.
-
Ok,
I apologize to mother tongue people for my English, I know, it isn’t good
Anyway, If I have understood correctly there is a limit of 1Mb, but limit apart, to do this I always do:The server application
- Send a header with a fixed size and with the following information: a security key (to recognise a my flow), data size, …. and then send data
- You can get and save a pointer of data from QbyteArray by “data” function
- With a loop I send few pieces of data ( < 1Mb) by writeDatagram, it is easy, all you need to do you have to use an index to move on the data pointer
The client application:
- When it will receive your header and recognise it, it will know data size too
- read all data that will receive and reassemble the all image
For me UDP is a good choice.
I hope to help you.