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. Exchange data beetwen two machines with qt app

Exchange data beetwen two machines with qt app

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 821 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.
  • D Offline
    D Offline
    Damian7546
    wrote on last edited by
    #1

    Hi
    I have two machines with qt applications like below:
    Bez tytułu.jpg

    How is the simples way to to communication by App1 and App2 ? I need from App1 set DIO in App2 ?
    The QLockalServer and QLockalSocket it will be ok ?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Damian7546 said in Exchange data beetwen two machines with qt app:

      QLockalServer

      If App1 and app2 is not on the same pc, then use
      QTcpServer/QTcpSocket.

      1 Reply Last reply
      3
      • D Offline
        D Offline
        Damian7546
        wrote on last edited by
        #3

        @mrjj What do you think about ModbusTCP ? Or MQTT ?

        JoeCFDJ 1 Reply Last reply
        0
        • D Damian7546

          @mrjj What do you think about ModbusTCP ? Or MQTT ?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          @Damian7546 It is simpler to use only QTcpServer/QTcpSocket since both machines have qt and you may not want to add another package while qt can handle it. When more packages are involved, you will need more efforts unless you are very familiar with third party packages.
          If machine 1 has Qt and machine 2 does not have Qt, you go with mqtt. That could be the case when a GUI controller is connected to a robot.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Damian7546
            wrote on last edited by
            #5

            @JoeCFD
            QtcpServer and QTcpClient will be optimal for exchange data like on below diagram:
            schemat.jpg
            ?

            JonBJ 1 Reply Last reply
            0
            • D Damian7546

              @JoeCFD
              QtcpServer and QTcpClient will be optimal for exchange data like on below diagram:
              schemat.jpg
              ?

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

              @Damian7546
              Hi, is your last post a statement or a question? Yes you will be able to exchange a QByteArray if both sides are Qt programs. You might look at QDataStream Class for sending/receiving the Qt classes.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Damian7546
                wrote on last edited by Damian7546
                #7

                @JonB First attempt I am making with Modbus TCP protocol.. Following the example delivered with Qt Creator installer - Modbus Slave xample, I created class which one create Modbus TCP Server and share my data in QByteArray and QBitArray .Now I wonder if QModbusServer create a new thread for new Client connection ?
                Should I think about it myself and do this ?
                Even just one client with too many queries can crash my application ? I 'm right ?

                Sorry for trivial questions - I know industrial protocols very well, but not implemented in Qt, only PLC :)

                jsulmJ 1 Reply Last reply
                0
                • D Damian7546

                  @JonB First attempt I am making with Modbus TCP protocol.. Following the example delivered with Qt Creator installer - Modbus Slave xample, I created class which one create Modbus TCP Server and share my data in QByteArray and QBitArray .Now I wonder if QModbusServer create a new thread for new Client connection ?
                  Should I think about it myself and do this ?
                  Even just one client with too many queries can crash my application ? I 'm right ?

                  Sorry for trivial questions - I know industrial protocols very well, but not implemented in Qt, only PLC :)

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Damian7546 said in Exchange data beetwen two machines with qt app:

                  Even just one client with too many queries can crash my application ?

                  Crash? I guess you mean that too many requests could block your event loop?
                  To answer this question you should actually first do benchmarking and only introduce threads if you really have to.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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