Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
182:f039ec218c9f
Parent:
181:bcfe7fe2142d
Child:
183:6d3ba874b267
diff -r bcfe7fe2142d -r f039ec218c9f PPP-Blinky/ppp-blinky.cpp
--- a/PPP-Blinky/ppp-blinky.cpp	Mon Sep 11 16:54:18 2017 +0000
+++ b/PPP-Blinky/ppp-blinky.cpp	Mon Sep 11 17:24:05 2017 +0000
@@ -1,4 +1,4 @@
-// PPP-Blinky - "The Most Basic Internet Of a Thing"
+// PPP-Blinky - "The Most Basic Internet Thing"
 // A Tiny HTTP Webserver Using Windows XP/7/8/10/Linux Dial-Up Networking Over A Serial Port.
 // Receives UDP packets and responds to ping (ICMP Echo requests)
 // WebSocket Service - see https://en.wikipedia.org/wiki/WebSocket
@@ -31,10 +31,10 @@
 
 // Special pages when PPP-Blinky is running
 // 172.10.10.2  root page
-// 172.10.10.2/x  returns a number that increments every time you request a page - this is handy for testing
-// 172.10.10.2/xb  also returns a number, but issues a fast refresh meta command. This allows you to use your browser to benchmark page load speed
+// 172.10.10.2/x  returns the number of ppp frames sent - this is handy for testing
+// 172.10.10.2/xb  also returns number of ppp frames sent, but issues a fast refresh meta command. This allows you to use your browser to benchmark page load speed
 // 172.10.10.2/ws  a simple WebSocket demo
-// http://jsfiddle.net/d26cyuh2/  more complete WebSocket demo in JSFiddle
+// http://jsfiddle.net/d26cyuh2/  more complete WebSocket demo in JSFiddle, showing cross-domain access
 
 // Ok, enough talking, time to check out some code!!
 
@@ -45,7 +45,7 @@
 // Using the second serial port will slow down packet response time
 // Note - the LPC11U24 does NOT have a second serial port
 
-#define SERIAL_PORT_MONITOR_NO /* change to SERIAL_PORT_MONITOR_YES for debug messages */
+#define SERIAL_PORT_MONITOR_YES /* change to SERIAL_PORT_MONITOR_YES for debug messages */
 
 // here we define the OPTIONAL, second debug serial port for various mbed target boards
 #ifdef SERIAL_PORT_MONITOR_YES
@@ -74,11 +74,11 @@
 #endif
 
 // verbosity flags used in debug printouts - change to 1 to see increasingly more detailed debug info.
-#define v0 0
+#define v0 1
 #define v1 0
 #define v2 0
-#define IP_HEADER_DUMP_NO /* YES for ip header dump */
-#define TCP_HEADER_DUMP_NO /* YES for tcp header dump */
+#define IP_HEADER_DUMP_YES /* YES for ip header dump */
+#define TCP_HEADER_DUMP_YES /* YES for tcp header dump */
 
 // this is the webpage we serve when we get an HTTP request to root (/)
 // keep size under ~900 bytes to fit into a single PPP packet
@@ -1065,7 +1065,7 @@
     dumpHeaderIP(1); // dump outgoing IP header before sending the frame
     dumpHeaderTCP(1); // dump outgoing TCP header before sending the frame
     dumpDataTCP(1); // dump outgoing TCP data before sending the frame
-    wait_ms(45); // 45 ms delay before sending frame - a typical internet delay time
+    if (0) wait_ms(45); // 45 ms delay before sending frame - a typical internet delay time
     sendPppFrame(); // All preparation complete - send the TCP response
     if(0) dumpPPPFrame(); // set to 1 to dump transmitted ppp frame
     memset(ppp.pkt.buf+44,0,500); // flush out traces of previous data that we may scan for
@@ -1211,8 +1211,7 @@
 void waitForPppFrame()
 {
     while(1) {
-        //checkPc(); // handle received characters from the PC
-        //sendUdpData(); // handle received characters from the DEBUG TERMINAL
+        sendUdpData(); // handle received characters from the DEBUG TERMINAL
         if ( ppp.rx.head != ppp.rx.tail ) {
             int oldTail = ppp.rx.tail; // remember where the character is located in the buffer
             int rx = pc_getBuf(); // get the character