Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.

Dependencies:   mbed

Revision:
1:3ee499525aa5
Parent:
0:e614f7875b60
--- a/if/ppp/PPPNetIf.cpp	Sat Jun 12 06:01:50 2010 +0000
+++ b/if/ppp/PPPNetIf.cpp	Mon Jun 14 03:24:33 2010 +0000
@@ -79,14 +79,14 @@
   if(gprsErr)
     return PPP_NETWORK;
     
-  DBG("\r\nPPPNetIf: If Connected.\r\n");
+  DBG("If Connected.\r\n");
 
   if( userId == NULL )
     pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL);
   else
     pppSetAuth(PPPAUTHTYPE_PAP, userId, password); //TODO: Allow CHAP as well
     
-  DBG("\r\nPPPNetIf: Set Auth.\r\n");
+  DBG("Set Auth.\r\n");
   
   m_pIf->flushBuffer(); //Flush buffer before passing serial port to PPP
     
@@ -98,7 +98,7 @@
     return PPP_PROTOCOL;
   }
   
-  DBG("\r\nPPPNetIf: PPP Started with res = %d.\r\n", res);
+  DBG("PPP Started with res = %d.\r\n", res);
   
   m_fd = res;
   m_connected = true;
@@ -109,13 +109,13 @@
     poll();
     if(t.read_ms()>PPP_TIMEOUT)
     {
-      DBG("\r\nPPPNetIf: Timeout.\r\n");  
+      DBG("Timeout.\r\n");  
       disconnect();
       return PPP_PROTOCOL;
     }
   }
   
-  DBG("\r\nPPPNetIf: Callback returned.\r\n");
+  DBG("Callback returned.\r\n");
   
   if( m_status == PPP_DISCONNECTED )
   {
@@ -194,7 +194,7 @@
 //Link Callback
 void PPPNetIf::pppCallback(int errCode, void *arg)
 {
-  //DBG("\r\nPPPNetIf: Callback errCode = %d.\r\n", errCode);
+  //DBG("Callback errCode = %d.\r\n", errCode);
   switch ( errCode )
   {
     //No error