Improved Ethernet-gateway
-
I did improve stability of ethernet-gateway in respect to reconnect:
Issue with relying on server.available() + server.write() is that it allows to connect with multiple clients. That might be fine with other protocols, but doesn't make a lot of sense as the gateway is by design connected to a single controller only. It also has issues when (re-)connecting more than 4 times in a row without doing a proper shutdown of previous connections as both WIZ5100 and UIPEthernet support only a limited (4) connections in parallel and TCP-timeouts are quite long so the gateway wouldn't notice not being connected to a valid remote-socket any more if you e.g. do a hard power down and reboot of your controller.
The change I made makes sure that whenever the controller reconnects any previous connection is properly removed by calling client.stop().
Works using Arduino-IDE 1.0.6/1.5.7 (or later) as it makes use of operator== in EthernetClient (a change I added this to EthernetClient some month ago for this very purpose...)
-
@ntruchsess Good job, I had to do this to WIZ5200 too, although it has bigger buffers/supports more client connections. Same situation for Iboard PRO (with onboard NET, I think 5100)
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Adding Listen only device to my system.
Development • 26 Feb 2025, 00:39 • dpcons 26 Feb 2025, 06:26 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 12 Mar 2025, 23:39