sourceperl / pyModbusTCP

A simple Modbus/TCP library for Python
MIT License
307 stars 106 forks source link

Restart server on network interface down #51

Closed fakuivan closed 1 year ago

fakuivan commented 2 years ago

We're building a Modbus TCP server that publishes the value of some sensors as Modbus registers. This server binds to the IP address of an ethernet port, if this port goes down, the server just keeps running like if nothing happened. Is there a way I can detect this and restart the server until the Ethernet port is reconnected?

sourceperl commented 2 years ago

I just did some tests (on linux) but I can't reproduce the problem.

  1. Server start: ./examples/server.py -H 192.168.1.45
  2. Some request with a client: mbtget 192.168.1.45. This work fine.
  3. Disconnect Ethernet, client failled: it's ok.
  4. Connect Ethernet, wait 10s for interface go up.
  5. Some request with a client: mbtget 192.168.1.45. This work fine. 🤔

Perhaps a problem with client that don't detect TCP socket reset or a firewalling issue ?