libmodbus
libmodbus copied to clipboard
When I use modbus tcp master mode, how do I know that the slave has closed the connection?
When I use modbus tcp master mode, how do I know that the slave has closed the connection?
once "modbus_receive" returns -1 you can be sure that the connection is dead ....
you have to close the active socket like this: close(modbus_get_socket(tcp_srv_mb));