Results 1 to 7 of 7

Thread: Speaking Applications in Qt

  1. #1
    Join Date
    Sep 2011
    Posts
    8
    Platforms
    MacOS X

    Default Speaking Applications in Qt

    I need to write 2 applications that can speak with each other on the same computer?

    What is the best way of doing it in QT?

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    20
    Thanked 28 Times in 27 Posts

    Default Re: Speaking Applications in Qt

    Refer QProcess class. You can also use network classes to communicate by setting your own protocol

  3. #3
    Join Date
    Sep 2011
    Posts
    8
    Platforms
    MacOS X

    Default Re: Speaking Applications in Qt

    Can you refer to some example/s of setting my own protocol using network classes?

  4. #4
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    20
    Thanked 28 Times in 27 Posts

    Default Re: Speaking Applications in Qt

    Suppose App A is to send to App B. In app A make a class deriving from QTCPServer. There you maintain the state of connections to App A. Provide some handshake string to confirm. Then let App B ask for objects by stating, say the class names. The derived class in App A is supposed to send object class name, serialized object, etc. In app B, deserialize it and knowing the object type beforehand, you can deserialize and you have your object in B. Protocol will be your way how you wish your apps to talk. Since tcp guarantees delivery, it can be implemented.
    As far as examples are concerned, merely knowing network classes and qtcpserver class should suffice. However, this does assume you are making both the applications. I had used this to communicate a qt app with a .net app. There I had to make sure I transfer only most basic types like int, double, array etc and manage endianness because .net didn't know how qt does its serialization. If both are qt apps, if both apps have same class definitions, you can transfer whole data objects in one go and deserialize at the other end. Obviously this means that both applications have the same definitions of classes of data objects you are sending over. A more smart serialization process, where in you serialize basic types with some string pair, etc. might be a good idea too.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Speaking Applications in Qt

    Those apps are running on the same machine. Using TCP seems like a bit of overkill.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    20
    Thanked 28 Times in 27 Posts

    Default Re: Speaking Applications in Qt

    Agreed. It will be like sending entire US army to find one person. But the question is will it be just as much costly and time taking?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Speaking Applications in Qt

    If you use QLocalSocket or a number of other IPC mechanisms available, you don't have to worry about most of the things you mention.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. using GPU with Qt applications
    By budda in forum Qt Programming
    Replies: 7
    Last Post: 25th August 2011, 09:02
  2. What to use for web applications?
    By szisziszilvi in forum Newbie
    Replies: 1
    Last Post: 7th April 2011, 07:25
  3. Qt applications and USB
    By pocketchange in forum Newbie
    Replies: 2
    Last Post: 11th March 2011, 05:16
  4. what's the matter with my qt applications?
    By xylosper in forum Qt Programming
    Replies: 4
    Last Post: 12th June 2007, 17:25
  5. Deploying QT applications
    By SteM in forum Installation and Deployment
    Replies: 3
    Last Post: 6th June 2007, 10:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.