Exchange data beetwen two machines with qt app
-
Hi
I have two machines with qt applications like below:

How is the simples way to to communication by App1 and App2 ? I need from App1 set DIO in App2 ?
TheQLockalServerandQLockalSocketit will be ok ? -
@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. -
@mrjj What do you think about ModbusTCP ? Or MQTT ?
-
@mrjj What do you think about ModbusTCP ? Or MQTT ?
@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. -
@JoeCFD
QtcpServer and QTcpClient will be optimal for exchange data like on below diagram:

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

?@Damian7546
Hi, is your last post a statement or a question? Yes you will be able to exchange aQByteArrayif both sides are Qt programs. You might look at QDataStream Class for sending/receiving the Qt classes. -
@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 ifQModbusServercreate 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 :)
-
@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 ifQModbusServercreate 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 :)
@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.