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

asked Feb 16, 2015 at 9:52

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.

answered Feb 17, 2015 at 23:37
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.

answered Apr 5, 2015 at 22:03
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.

answered Jan 1, 2016 at 1:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.