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. Control the Behaviour of one instance from another ( kill or run )
Forum Updated to NodeBB v4.3 + New Features

Control the Behaviour of one instance from another ( kill or run )

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.0k 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
    starbearer
    wrote on last edited by
    #1

    I have a QtSingleApplication.

    I've started an instance A.

    Next I start an instance B.

    B uses sendmessage() to send a message to A.

    A uses this message ( received with messageReceived() signal )to determine whether B should continue running or not.

    How do I inform B of this decision?

    I had thought of inserting the process ID of B..with the message sent to A, and using this process ID, perhaps A can force B's closure or have it continue?

    If this is a correct flow, how do I get the process Id ( I don't know whether there'll be one for QtSingleApplication, or for a process, and if Pid QProcess::processID() ), will be any good? ).

    Also, once I have it, how do I force B's closure? Or inform it of any message?

    Please help me with it. Thank you.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      I think that I'd make B listen on a port, and communicate the port number to A. Then A can open a connection to B on that port, and you can use a simple protocol over TCP to communicate between the instances. You could also considder using a solution like "QxtRPCPeer":http://libqxt.bitbucket.org/doc/0.6/qxtrpcpeer.html for your communication.

      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