Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QUdpSocket does not trigger ReadyRead signal
Qt 6.11 is out! See what's new in the release blog

QUdpSocket does not trigger ReadyRead signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 6 Posters 11.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O onurcevik

    @aha_1980

    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:

    aha_1980A Offline
    aha_1980A Offline
    aha_1980
    Lifetime Qt Champion
    wrote on last edited by
    #16

    @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.

    Qt has to stay free or it will die.

    O 1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #17

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • aha_1980A aha_1980

        @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.

        O Offline
        O Offline
        onurcevik
        wrote on last edited by onurcevik
        #18

        @aha_1980 I now realized that I can't even send the socket due to large size which is 1 mb. Do you know how can I divide it into chunks of bytes ? Or should I create new topic?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #19

          What exactly is the goal of your application ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          O 1 Reply Last reply
          1
          • SGaistS SGaist

            What exactly is the goal of your application ?

            O Offline
            O Offline
            onurcevik
            wrote on last edited by
            #20

            @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.

            1 Reply Last reply
            0
            • CP71C Offline
              CP71C Offline
              CP71
              wrote on last edited by CP71
              #21

              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.

              JonBJ 1 Reply Last reply
              3
              • CP71C CP71

                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.

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #22

                @CP71 said in QUdpSocket does not trigger ReadyRead signal:

                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.

                How do you manage to "read all data" corresponding to "it will know data size" given that you're using UDP?

                CP71C 1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #23

                  If you want to stream videos then you should follow the standards currently used to minimise bandwidth usage while keeping image quality.

                  As for video processing, you should give more information about what you want to do.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • JonBJ JonB

                    @CP71 said in QUdpSocket does not trigger ReadyRead signal:

                    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.

                    How do you manage to "read all data" corresponding to "it will know data size" given that you're using UDP?

                    CP71C Offline
                    CP71C Offline
                    CP71
                    wrote on last edited by
                    #24

                    @JonB Ok,
                    you are right, I think to know what you want to say, all depend of kind of application you are doing.
                    You believe me, I done real-time application with UDP and they work well.
                    Ok, TCP is more safety but UDP is faster, I’m not game developer but as far as I know more games are based on UDP, because it is faster.
                    It's obvious, the client must check the integrity of data and discard the bad data, e.g by checksum.
                    I don’t know the goal of @onurcevik, but if a frame video is delayed or lost it will be discarded.
                    All depend if you want to prefer the speed or the quality of information therefore what the client application must do.

                    JonBJ 1 Reply Last reply
                    0
                    • CP71C CP71

                      @JonB Ok,
                      you are right, I think to know what you want to say, all depend of kind of application you are doing.
                      You believe me, I done real-time application with UDP and they work well.
                      Ok, TCP is more safety but UDP is faster, I’m not game developer but as far as I know more games are based on UDP, because it is faster.
                      It's obvious, the client must check the integrity of data and discard the bad data, e.g by checksum.
                      I don’t know the goal of @onurcevik, but if a frame video is delayed or lost it will be discarded.
                      All depend if you want to prefer the speed or the quality of information therefore what the client application must do.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by JonB
                      #25

                      @CP71
                      You may well know more than I. But as I understand it UDP can happily lose any packets at the client, that's the point of it. By splitting your datagrams like you said if one does not arrive what happens at the client, it seems to me that protocol just won't work? Maybe in your "real-world" apps none get missed, I don't actually have experience, I am just interested/concerned. :)

                      CP71C 1 Reply Last reply
                      1
                      • JonBJ JonB

                        @CP71
                        You may well know more than I. But as I understand it UDP can happily lose any packets at the client, that's the point of it. By splitting your datagrams like you said if one does not arrive what happens at the client, it seems to me that protocol just won't work? Maybe in your "real-world" apps none get missed, I don't actually have experience, I am just interested/concerned. :)

                        CP71C Offline
                        CP71C Offline
                        CP71
                        wrote on last edited by
                        #26

                        @JonB Don’t worry, I happy to communicate with you, so I’m training in English that is useful for me ;).
                        I don’t know if I can post a link to other site or forum, so I avoid.
                        I don’t say UDP is better than of TCP, I say that depend of your goal of application, each protocol has its scope.
                        For me, I would use UDP for stream video, especially if the client must be only show the image.
                        But it is only my idea.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved