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. [SOLVED ]QUdpSocket doesn't emit readyRead
Forum Updated to NodeBB v4.3 + New Features

[SOLVED ]QUdpSocket doesn't emit readyRead

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 6.7k 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 Offline
    O Offline
    olejacob
    wrote on last edited by
    #1

    Hi,

    I've browsed through this forum without any help at all. This computer is used professionally at work.
    My operation system is: Windows XP
    Qt version: 4.7.3
    MSVC 2010 Professional.

    I want to make a network linker that forwards different broadcasts to different network. Reason; We have a distributed network solution at our system, and we don't want to send unnecessary data due to the high update rate.

    I have installed two loopback adapters, and one network adapter + on wireless card.
    I've tried the Qt examples for UDP, which worked.

    For simplicity, I have used the Qt Network UDP sender, to ensure that I can read the UDP packets.
    The example programs UDP Sender and UDP Receiver, works perfectly.

    Wireshark reveals that the Qt UDP Sender example are sending from 192.168.100.5, and broadcasts to 255.255.255.255 to port 45454.

    Since the Qt UDP receiver application works, I did a cut 'n' paste on that code into mine.
    Code as follows:
    @
    udpSocket->bind(45454, QUdpSocket::ShareAddress);
    connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
    @

    But it didn't work at all.....

    What can I do?

    Best regards,

    Ole

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      I would make the connection before I bind. Theoretically, the readyRead() signal could have been fired before you made the connection. It won't be emitted until you have actually read some data. I am however not sure if this is what causes your issue.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        Are you returning to the event loop after those calls?

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • O Offline
          O Offline
          olejacob
          wrote on last edited by
          #4

          Hi,

          I did a QCoreApplication::sendPostedEvents after each signal-slot connection. That really made the trick. Why did this solve my problem?

          Thank you for the clue, peppe ;-)

          Cheers,

          Ole

          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