1

I have an arduino web server running from a mega 2560 and a wiznet ethernet shield.

It serves the single page just fine (and very fast) to the LAN (192.168.1.50), but serves the same page very, very, slowly when accessed from the WAN/Internet.

I have port forwarding set-up on the modem router so that the Arduino web page can be accessed from the outside world, and it does work, I can see the page from anywhere, but it's page serve rate is impractically slow. The page takes 30 - 45 seconds to load up.

(I have the RaspPi with Apache set-up, also in the house, using the exact same port forwarding settings - with a different port - and it serves pages to the WAN/Internet very fast).

Has anyone any ideas what might be wrong ?

Thank you

3 Answers 3

1

I haven't used the ethernet library for a while, but I remember that it served up tiny packets - basically each write call went in its own TCP packet. It sounds like you may have latency issues across the WAN.

You could try using your Apache instance to proxy the Arduino pages. Details are at http://httpd.apache.org/docs/current/mod/mod_proxy.html I have this running but all my pages are small so I'm not sure how it would behave on larger pages.

1

The answer is :

I combined all my

client.println("<b><font size=+1 color='#CC33FF'>Some text here</font></b><br/>");

html statements into much longer statements eg

client.println("<b><font size=+1 color='#CC33FF'>Some text here</font></b><br/><a href=\'?s4-all-on' target='x2'>All On</a>&nbsp;&nbsp;&nbsp;<a href='/?s4-all-off' target='x2'>All Off</a><br/><a href='/?s4-1on' target='x2'>Socket 1 On</a>&nbsp;&nbsp;&nbsp;<a href='/?s4-1off' target='x2'>Socket 1 Off</a><br/>"); 

This reduced the number of client.println(" "); statements by about one third, which resolved the issue.

0

This would be a good place to get out tcpdump or WireShark (or any other tool that will let you observe network traffic). If you watch the traffic while you're making the a request that goes to the Arduino (perhaps use a phone to make the request so that it comes from outside) you will be able to observe the TCP/IP transactions and see where the delays are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.