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. Legacy process and new Qt enable process
Forum Updated to NodeBB v4.3 + New Features

Legacy process and new Qt enable process

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.8k 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.
  • M Offline
    M Offline
    medvedm
    wrote on last edited by
    #1

    Hi - I'm working on a new system where I have a process that does network communication out to other computers in the system. It is code that I don't want to touch, and all I want to have it do is send a command to my new fancy Qt enabled process. Also, once a second the new process is going to send back a packet of status data to the legacy process, which will format it and send it out.

    Is there an IPC mechanism I can use that would enable this? Do I have to use an event, or can I use something like a QSocketNotifier. I guess it would be preferable to not have to use Qt libraries in the legacy process. What do you all think would be the best (and by best I mean easiest) way to do this?

    M

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      What does "network communication" mean? Qt supports "TCP":http://doc.qt.nokia.com/latest/qtcpsocket.html and "UDP":http://doc.qt.nokia.com/latest/qudpsocket.html out of the box. For local IPC there are "local sockets":http://doc.qt.nokia.com/latest/qlocalsocket.html as well (domain sockets, named pipes) as "shared memory":http://doc.qt.nokia.com/latest/qsharedmemory.html or "D-Bus":http://doc.qt.nokia.com/latest/qtdbus.html.

      Qt also supports system-independent "timers":http://doc.qt.nokia.com/latest/qtimer.html which can be used to invoke pieces of code in regular intervals.

      If it is networked communcation go for TCP or UDP (depending on your needs), otherwise you could use a local socket as well (which, in addition, means that your code can be easily upgraded to TCP or UDP or later on).

      1 Reply Last reply
      0
      • M Offline
        M Offline
        medvedm
        wrote on last edited by
        #3

        Network communication means the legacy code is opening TCP sockets and communicating with the computer that is the main controller for the whole system. I don't want to touch any of that because there is a protocol on top of TCP and it all "just works". So the networking stuff can simply be left alone. However, when a command comes in over the network, I want to be able to shove it through some IPC mechanism to my new software.

        I don't want to include Qt in the legacy process. Is there some IPC I can use (I'm running on Linux) in the legacy side that has a Qt coutnerpart? message queue? I'm not getting what QSocketNotifier does...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexisdm
          wrote on last edited by
          #4

          [quote author="medvedm" date="1314973517"]I'm not getting what QSocketNotifier does...[/quote]
          Basically, it uses something like select or epoll on a standard file descriptor to emit a Qt signal whenever it is ready either to read, write, or it has errors.
          You would still have to read it with either the standard C read function, or a QIODevice wrapped around it (with QFile::open(int fd,...) or QTcpSocket::setSocketDescriptor(int fd,...) (but QTcpSocket does already the notification part, so you wouldn't need to use QSocketNotifier with it)).

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            Use a domain socket, QLocalSocket resp. QLocalServer is the Qt counterpart. Or you just use QSocketNotifier and ordinary read/write methods as already suggested (example usage see "here":http://developer.qt.nokia.com/forums/viewthread/9254/).

            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