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 communicate 3 QProcess?

How to communicate 3 QProcess?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k 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.
  • S Offline
    S Offline
    sayeh_sh
    wrote on last edited by
    #1

    Hi, I need to communicate 3 process in Qt
    process1--> Parent
    process2--> Child1
    process3--> Child2
    help me please !!!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      What exactly do you mean?

      • Is process #1 your "main" (Qt-based) application, which then spawns processes #2 and #3?
      • Or is process #1 what is spawned by your "main" (Qt-based) application and process #1 will then spawn processes #2 and #3 without direct control of you "main" application?

      First case should be handled well by QProcess, just use two separate QProcess objects for each child process you spawn. In the latter case, you can only interact (directly) with process #1 via QProcess, but not with #2 or #3.

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sayeh_sh
        wrote on last edited by
        #3

        process parent is a Qt based application and the two others childs process will exchange simple messages between other and the process parent
        please give me a simple xample to illustrate this work!!

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          Just use two QProcess objects, one for each process to start.

          QProcess is inherited from QIODevice, so you can write to the process' STDIN via QProcess::write() and you can read from the process STDOUT/STDERR via QProcess::read(). See also QProcess::setReadChannel() to select between STDOUT, STDERR or both combined. Finally, you can use the signals readyReadStandardError and readyReadStandardOutput to read from the child process in an asynchronous way...

          Inside your child processes, if they are not made with Qt, simply use printf() for writing to the STDOUT and use fread(..., stdin) to read from the STDIN...

          See also:
          http://doc-snapshot.qt-project.org/4.8/qprocess.html

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          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