Go Down

Topic: Ethernet Shield does not respond consistantly (Read 219 times) previous topic - next topic


This is my first time looking for help on the forum, I just got started with Arduino in Jan this year, with no real programming experience. The forum had been great getting my this far along, but haven't found a answer to my problem below.

I'm using a Sunflower W5100 ethernet shield, with a Elegoo Mega, with mixed success. I am sending DHT11 data to a web page over the internet. Right now I'm using my external IP address and port forwarding on my Netgear WNDR3400 router. It actually functions fine, but when a request goes to the server, sometimes the server responds perfectly, or sometimes does not respond at all. Several requests may go thru OK then it stops responding. I may be hours before it responds again. I have found a way get it to respond right a way by pinging the server IP on my LAN, this gets it working immediately, but for how long is a unknown. Its also counterproductive if I have to"restart by sending a ping from my own LAN.
If i need to include more info, please let me know.

Thank for any help you can provide.


Your code has no way to free frozen sockets. If you are exposed to the internet, port scanners can eat all your sockets. Some open a socket, but never send anything and don't close it. Take a look at my server code.
At the bottom of the first example code are two functions that might interest you.
The loop function shows how I use them.


Apr 28, 2018, 05:36 pm Last Edit: Apr 28, 2018, 07:24 pm by mikb55
Any open port on an internet connected server will be hammered by malicious bots trying to find security weaknesses, so apart from the the handful of requests from your web browser there may also be dozens, hundreds, or thousands of requests per second from bots which will overwhelm the Arduino's ability to respond in a timely manner.

In terms of general troubleshooting, use a program such as Wireshark to:
1) Verify that every web browser request is reaching your Arduino.
2) Whether the Arduino sends any kind of response at all.

There's no point chasing bugs in your code if data is being lost due to network issues outside of your control.

Go Up