Results 1 to 2 of 2

Thread: Sending commands throught network

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    630
    Thanks
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Sending commands throught network

    Good morning, I would write an application ( or better add a feature to an existing application ) where an application sends some simple custom commands ( like "OPEN_DOOR" ) to another application. Both applications resides in different pcs.
    How can I do? I saw the QNetwork module but I'm not sure what I would is a client-server application as is just some custom string sending.
    For example pc1 send "OPEN_DOOR" to pc2 and this one execute a local slot.

    Best Regards,
    Franco
    Franco Amato

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Sending commands throught network

    There's no magic connection between signals in one process and slots in another.

    Your requirement to send a command from A to B makes A the client (sender) and B the server (receiver). Your sender needs to send the command and await the response (if any). Your receiver needs to listen for command(s), determine what command has been received, do something, and return a result. Depending on reliability requirements you could use QTcpSocket and QTcpServer, or QUdpSocket, if everything will be on the same machine then you could look at QLocalSocket/QLocalServer. See Inter-Process Communication in Qt

  3. The following user says thank you to ChrisW67 for this useful post:

    franco.amato (26th March 2012)

Similar Threads

  1. Get y throught x
    By ruzik in forum Qwt
    Replies: 6
    Last Post: 8th January 2012, 17:54
  2. How to InsertRow Throught QSqlQueryModel ?
    By innobleday in forum Qt Programming
    Replies: 0
    Last Post: 24th March 2010, 05:44
  3. serial port printer sending commands, how?
    By triperzonak in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2009, 15:51
  4. sending Text or binary file over network
    By Tavit in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2008, 01:42
  5. send own class reference throught signal
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2008, 22:55

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.