Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt5.6 linux libmodbus TCP server problem ....
gfxx last edited by
I have a Qthread with libmodbus TCP server code .... it works fine... it exange bit data with 5 master modbus write in C + libmodbus code.
For run all the system I must first start the master, than the Qt5 server (wiring is from common ethernet switch device and the lan network is PRIVATE). If I stop the QT5 server the master running without stop (the code works in these manner). But when reboot QT5 server the connection is not establish and I must stop the master and reboot it.
Is possible stop and run Qt5 server without reboot all master??
In attach the Qt5 server ...(someone suggest me that the problem is on Qt5 side...).
A Former User last edited by A Former User
Hi! I'm not sure if I understood this correctly: When the server dies, the masters keep doing their work but you want them to shut down, too? And when the server comes up again you want the masters to restart automatically but not manually or do you only want them to reconnect to the server?
beecksche last edited by
Is there a reason why you don't use the Qt QModbusTcpClient / -Server class? In general you start your modbus server first and then connect with your clients. If the server goes down the client should recognized it and try to connect it again. I would start a QTimer and connect the timeout signal to your connectToServer function. But this is really depending on your setup.
gfxx last edited by gfxx
very late reply ... but usefull for other user I hope:
these mechanism of libmodbus is responding to modicon standard ... so the problem I described is not a real problem ... But there is no law preventing the modbus server reset and its reboot to resolve disconnection problems ..... anyway using Qmodbus the "problem" is resolved.
So I can say that using Qt buses is generally quieter and more thoughtless (DBus & QCanbus)
As workaround of original problem ... a timeout for free the connection is what you need.