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. Communication between Qt application via QProcess

Communication between Qt application via QProcess

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 6 Posters 1.2k 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.
  • K Offline
    K Offline
    kirilsagoth
    wrote on last edited by
    #1

    Hi,

    I'm trying to implement two-sided communication between 2 Qt apps,
    Saw this might be possible via a main app launching the second app through a wrapped QProcess and connecting signals both ways ...

    What I don't get is how do I get the access from the application that is launched by the QProcess (and the other way around - how send a signal to the started application)?

    Thanks.

    Kent-DorfmanK JonBJ 2 Replies Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #3

      I would actually just use QLocalSocket and trasmit data as it was a normal socket

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      K 1 Reply Last reply
      4
      • CKurduC Offline
        CKurduC Offline
        CKurdu
        wrote on last edited by
        #2

        Hi,
        If you mean sending commands and getting results you can use standard read , write channels and the signal named QProcess::readyReadStandardOutput

        You reap what you sow it

        1 Reply Last reply
        2
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #3

          I would actually just use QLocalSocket and trasmit data as it was a normal socket

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          K 1 Reply Last reply
          4
          • K kirilsagoth

            Hi,

            I'm trying to implement two-sided communication between 2 Qt apps,
            Saw this might be possible via a main app launching the second app through a wrapped QProcess and connecting signals both ways ...

            What I don't get is how do I get the access from the application that is launched by the QProcess (and the other way around - how send a signal to the started application)?

            Thanks.

            Kent-DorfmanK Offline
            Kent-DorfmanK Offline
            Kent-Dorfman
            wrote on last edited by
            #4

            @kirilsagoth said in Communication between Qt application via QProcess:

            Hi,

            I'm trying to implement two-sided communication between 2 Qt apps,
            Saw this might be possible via a main app launching the second app through a wrapped QProcess and connecting signals both ways ...

            What I don't get is how do I get the access from the application that is launched by the QProcess (and the other way around - how send a signal to the started application)?

            Thanks.

            No. Wrong way to do this. The correct way to do this is IPC or interprocess communications. pipes, shared memory, sockets, messages queues, etc. There exist several mechanisms.

            Your way is fine if you have a master program that needs to spawn "existing" system commands and gather their responses, but for real IPC between two Qt apps use the mechanisms I've listed.

            1 Reply Last reply
            4
            • K kirilsagoth

              Hi,

              I'm trying to implement two-sided communication between 2 Qt apps,
              Saw this might be possible via a main app launching the second app through a wrapped QProcess and connecting signals both ways ...

              What I don't get is how do I get the access from the application that is launched by the QProcess (and the other way around - how send a signal to the started application)?

              Thanks.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #5

              @kirilsagoth
              I too would probably use @VRonin's QLocalSocket for this. However, if you do not want to get into how to set up sockets for this, and you are still having the parent process spawn the other process through QProcess, you could alternatively use the fact that QProcess connects the output/stdout of the parent to the child's input/stdin, and vice versa. So you can send writes from each side to reads at the other side from the start.

              1 Reply Last reply
              0
              • VRoninV VRonin

                I would actually just use QLocalSocket and trasmit data as it was a normal socket

                K Offline
                K Offline
                kirilsagoth
                wrote on last edited by
                #6

                @VRonin said in Communication between Qt application via QProcess:

                QLocalSocket

                @VRonin Thanks MAN! QLocalServer/Socket did the job beautifully.

                Pablo J. RoginaP 1 Reply Last reply
                0
                • K kirilsagoth

                  @VRonin said in Communication between Qt application via QProcess:

                  QLocalSocket

                  @VRonin Thanks MAN! QLocalServer/Socket did the job beautifully.

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on last edited by
                  #7

                  @kirilsagoth said in Communication between Qt application via QProcess:

                  QLocalServer/Socket did the job beautifully.

                  So please mark your post as solved! Thanks.

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  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