Networking stack: HTTP Server simplest example

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Wed May 26 11:56:08 2010 +0000
Commit message:

Changed in this revision

HttpServerHelloWorld.cpp Show annotated file Show diff for this revision Revisions of this file
NetEthApiLPC1768.lib Show annotated file Show diff for this revision Revisions of this file
NetServicesLPC1768.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HttpServerHelloWorld.cpp	Wed May 26 11:56:08 2010 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HttpServer.h"
+
+EthernetNetIf eth;  
+HttpServer svr;
+
+DigitalOut led1(LED1);
+
+int main() {
+  printf("\r\nSetting up...\r\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+    printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  printf("\r\nSetup OK\r\n");
+  
+  svr.addHandler<SimpleHandler>("/"); //Default handler
+  svr.bind(80);
+  
+  printf("\r\nListening...\r\n");
+    
+  Timer tm;
+  tm.start();
+  //Listen indefinitely
+  while(true)
+  {
+    Net::poll();
+    if(tm.read()>.5)
+    {
+      led1=!led1; //Show that we are alive
+      tm.start();
+    }
+  }
+  
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NetEthApiLPC1768.lib	Wed May 26 11:56:08 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/NetEthApiLPC1768/#2929fcb16bbf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NetServicesLPC1768.lib	Wed May 26 11:56:08 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/NetServicesLPC1768/#acb9b7d53771
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 26 11:56:08 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e6be4cd80aad