Arduino Ethernet shield illustrates inner workings of servers

Arduino Ethernet Shield
With the Arduino Ethernet shield that I recently purchased I have been doing a lot of programming involving making a web page. The pages that I have programmed are somewhat simple and use all of the usual HTML tags but since i'm not using any server at all this has been very interesting. My current setup for the arduino web server on the robot is using the Ethernet shield as an adapter to send the code over the internet via a wireless router. Why I think this is so cool is that it is just like a real server in the sense that it is giving information to a user's computer. I have set up servers before and I have designed web pages to go on them but part of programming them to run from the arduino shows something that most people never think of. When you learn how a website works; how a server sends the information to your browser you don't usually think about what it takes beyond a few HTML and PHP files to generate the webpage that you are looking at. With the arduino relay shield you can see in the code that it really is sending the information.

This is a sample of the code that I have been talking about:


   client.println("<html><head><title>arduino web page</title></head><body>");
   client.println("<h1>Example Web Page</h1>");
   client.println("<p>This is some page text.</p>");
   client.println("<p>You should visit http://robotrecycled.blogspot.com for more information.</p>");
   client.println("</body></html>")

This code is sent by the Arduino and received by a user's browser and is indistinguishable from any other webpage that could be displayed by a real server. I thought it was interesting because the " client.println " part that tells the Arduino to send the code to the user's browser is actually visible. Normally servers handle these requests using separately installed software but with the Arduino it is actually the worlds smallest server!
◄ Newer Post Older Post ►
 

Copyright 2011 robot recycled parts is proudly powered by blogger.com