![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
SimpleSocket 1.0 examples
Dependencies: EthernetNetIf SimpleSocket 1.0 mbed
Diff: webserver.cpp
- Revision:
- 33:39d9cdf99de8
- Parent:
- 32:00114e36de90
- Child:
- 34:a108bcc26b69
--- a/webserver.cpp Wed Oct 26 12:47:31 2011 +0000 +++ b/webserver.cpp Wed Nov 02 12:16:51 2011 +0000 @@ -1,16 +1,33 @@ -#include "mbed.h" +#include "EthernetNetIf.h" #include "SimpleSocket.h" - // <META HTTP-EQUIV=\"Refresh\" CONTENT=\"5\">\ -char *response0 = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\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\">"; -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"; +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\">"; +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();