libmodbus icon indicating copy to clipboard operation
libmodbus copied to clipboard

When I use modbus tcp master mode, how do I know that the slave has closed the connection?

Open jhembed opened this issue 1 year ago • 1 comments

When I use modbus tcp master mode, how do I know that the slave has closed the connection?

jhembed avatar Aug 26 '23 03:08 jhembed

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));

oe5hpm avatar Aug 26 '23 15:08 oe5hpm