SimpleSocket 1.0 examples

Dependencies:   EthernetNetIf SimpleSocket 1.0 mbed

Revision:
35:3fc65b5d6340
Parent:
34:a108bcc26b69
Child:
36:03c4e6a9a9e9
diff -r a108bcc26b69 -r 3fc65b5d6340 webserver.cpp
--- a/webserver.cpp	Fri Nov 04 06:04:36 2011 +0000
+++ b/webserver.cpp	Fri Nov 04 09:51:34 2011 +0000
@@ -1,37 +1,37 @@
 #include "EthernetNetIf.h"
 #include "SimpleSocket.h"
 
-char *response0 = 
-    "HTTP/1.1 200 OK\r\n"
-    "Content-Type: text/html\r\n"
-    "\r\n"
-    "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5\">\r\n"
-    "<html>\r\n"
-    "<head>\r\n"
-    "<title>mbed web server</title>\r\n"
-    "</head>\r\n"
-    "<body>\r\n"
-    "<h2>Analog Input</h2>\r\n"
-    "<table cellpadding=\"5\">\r\n";
-char *response1 = 
-    "<tr style=\"background:#ccccff\">"
-    "<th>pin</th><th>value</th>"
-    "</tr>\r\n";
-char *response2 =
-    "<tr style=\"background:#cccccc\">"
-    "<td>p%d</td><td align=\"center\">%f</td>"
-    "</tr>\r\n";
-char *response3 =
-     "</table>\r\n"
-    "</body>\r\n"
-    "</html>\r\n";
+void webserver() {
+    char *response0 =
+        "HTTP/1.1 200 OK\r\n"
+        "Content-Type: text/html\r\n"
+        "\r\n"
+        "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5\">\r\n"
+        "<html>\r\n"
+        "<head>\r\n"
+        "<title>mbed web server</title>\r\n"
+        "</head>\r\n"
+        "<body>\r\n"
+        "<h2>Analog Input</h2>\r\n"
+        "<table cellpadding=\"5\">\r\n";
+    char *response1 =
+        "<tr style=\"background:#ccccff\">"
+        "<th>pin</th><th>value</th>"
+        "</tr>\r\n";
+    char *response2 =
+        "<tr style=\"background:#cccccc\">"
+        "<td>p%d</td><td align=\"center\">%f</td>"
+        "</tr>\r\n";
+    char *response3 =
+        "</table>\r\n"
+        "</body>\r\n"
+        "</html>\r\n";
 
-void webserver() {
     EthernetNetIf eth;
     eth.setup();
-    
+
     ServerSocket server(80);
-    
+
     while (true) {
         ClientSocket socket = server.accept();
         while (socket) {
@@ -42,7 +42,7 @@
                 socket.printf(response1);
                 AnalogIn analogPin[] = {p15, p16, p17, p18, p19, p20};
                 for (int i = 0; i < 6; i++)
-                     socket.printf(response2, 15 + i, analogPin[i].read());
+                    socket.printf(response2, 15 + i, analogPin[i].read());
                 socket.printf(response3);
                 socket.close();
             }