Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    ReadyRead synchronous issue

    General and Desktop
    3
    3
    448
    Loading More Posts
    • 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.
    • J
      Jeffson last edited by

      Hi,Guys

      I have an problem in implementing a udp socket buffer behavior in QT,
      anyone can help me?

      The details:I want to create a buffer to hold coming data,the "ReadyRead" slot is responsible for recieving.
      After i recieve the packet,i want to play the packet which is in audio format.
      The playing part is also implemented inside "ReadyRead" function.
      The thing is when I play the packet,the "ReadyRead" blocked,did not recieve packet anymore,
      which will cause the packet recieving delay.

      how can make the recieving and playing synchronous?

      Thanks.

      kshegunov 1 Reply Last reply Reply Quote 0
      • m.sue
        m.sue last edited by m.sue

        Hi,
        you should consider to source out the "playing" (or the reading) into a different thread, so "reading" and "playing" can happen "simultaneously". Well reading will in fact always be some time ahead. Keep in mind how Youtube does and shows it in co-operation with your browser with the gray and red part of the progress bar.
        I would call this pattern where one part does not wait on another to finish "asynchronous", though.
        -Michael.

        1 Reply Last reply Reply Quote 1
        • kshegunov
          kshegunov Moderators @Jeffson last edited by

          If you do a lengthy operation in the slot the events are waiting in a queue and nothing else is happening with your program. You need to use threads. Either put the UDP communication in a separate thread or the playback in a separate thread.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply Reply Quote 1
          • First post
            Last post