From 57c941f4a936bc7d53a1af6bf00a33023817fdee Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 8 Sep 2008 20:05:31 +0000 Subject: Renaming ethernet library examples. --- .../Ethernet/examples/echo_server/echo_server.pde | 53 ---------------------- 1 file changed, 53 deletions(-) delete mode 100644 libraries/Ethernet/examples/echo_server/echo_server.pde (limited to 'libraries/Ethernet/examples/echo_server') diff --git a/libraries/Ethernet/examples/echo_server/echo_server.pde b/libraries/Ethernet/examples/echo_server/echo_server.pde deleted file mode 100644 index e16dcb9..0000000 --- a/libraries/Ethernet/examples/echo_server/echo_server.pde +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Echo Server - * - * Echoes back the headers of the web request. Good for - * learning how the HTTP protocol works. - */ - -#include - -byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; -byte ip[] = { 10, 0, 0, 177 }; - -Server server(80); - -void setup() -{ - Client client(255); - Ethernet.begin(mac, ip); - Serial.begin(9600); - server.begin(); -} - -void loop() -{ - char buf[512]; - int i = 0; - Client client = server.available(); - if (client) { - boolean previous_is_newline = false; - while (client.connected()) { - if (client.available()) { - char c = client.read(); - if (c == '\n' && previous_is_newline) { - buf[i] = 0; - client.println("HTTP/1.1 200 OK"); - client.println("Content-Type: text/html"); - client.println(); - client.println("
");
-          client.println(buf);
-          client.println("
"); - break; - } - if (i < 511) - buf[i++] = c; - if (c == '\n') - previous_is_newline = true; - else if (c != '\r') - previous_is_newline = false; - } - } - client.stop(); - } -} -- cgit v1.2.3-18-g5258