Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Best way to transfer data between two threads ?

Best way to transfer data between two threads ?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.6k 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.
  • G Offline
    G Offline
    gaganbm
    wrote on last edited by
    #1

    Hi,

    I have a main GUI thread and a separate thread for network connectivity and reading data from TCP Socket.

    The data read from the TCPSocket is to be sent to the main GUI thread for further processing. What is the best way to achieve this ?

    Should I use a shared buffer or a queued signal-slot connection is optimal ?
    (The TCPSocket data are expected to come pretty frequently.)

    Thanks

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      You don't need a separate thread for networking.

      Just use the QTcpSocket's asynchronous API: connect the readyRead() signal to a slot that reads and processes the data. Your GUI will remain responsive.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      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