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. How to break from the Waitforreadyread in QUdpSocket
Forum Updated to NodeBB v4.3 + New Features

How to break from the Waitforreadyread in QUdpSocket

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 299 Views
  • 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.
  • ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by ManiRon
    #1

    I have a program in which i bind and receive data in a QThread , when i press a start button on my UI i start my thread and wait in (WaitForReadyRead) infinitely till i get any data , Inbetween if i want to terminate the wait , How can this be done ? . I tried to close the connection when the execution is waiting at WaitForReadyRead and i end up having an assertion , How to do this ?

    aha_1980A 1 Reply Last reply
    0
    • ManiRonM ManiRon

      I have a program in which i bind and receive data in a QThread , when i press a start button on my UI i start my thread and wait in (WaitForReadyRead) infinitely till i get any data , Inbetween if i want to terminate the wait , How can this be done ? . I tried to close the connection when the execution is waiting at WaitForReadyRead and i end up having an assertion , How to do this ?

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

      Hi @ManiRon,

      is there a reason you need to use waitForReadyRead()? Things would be much easier if you just connect a slot to the readyRead() signal.

      But well, if you insist to do it like that, then you'll have to create a loop and give the wait function a timeout. Then you call it again if the connection is not about to close.

      But honestly, that feels like an ugly hack.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      5

      • Login

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