Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
111:6a3b77c065c0
Parent:
110:baec959e1915
Child:
112:30172f36bd33
diff -r baec959e1915 -r 6a3b77c065c0 main.cpp
--- a/main.cpp	Fri Aug 04 10:19:41 2017 +0000
+++ b/main.cpp	Fri Aug 04 20:59:40 2017 +0000
@@ -217,7 +217,7 @@
 {
     led1Toggle(); // change led1 state on every frame we receive
     if(start==end) {
-        return;
+        return; // empty frame
     }
     crcReset();
     char * dest = ppp.pkt.buf;
@@ -248,7 +248,7 @@
         void determinePacketType(); // declaration only
         determinePacketType();
     } else {
-        if (0) { // don't normally report FCS because windows early-terminates packets, and early-terminated packets all have FCS errors.
+        if (0) { // don't normally report FCS because windows frequently early-terminates packets, and early-terminated packets all have FCS errors.
             debug("\nPPP FCS(crc) Error CRC=%x Length = %d\n",ppp.pkt.crc,ppp.pkt.len); // ignore packets with CRC errors but print a debug line
         }
     }
@@ -576,7 +576,6 @@
     nHeader=n; // size of HTTP header
     if( httpGetRoot == 0 ) {
         // this is where we insert our web page into the buffer
-        //n=n+sprintf(n+dataStart,"%s", ourWebPage);
         memcpy(n+dataStart,rootWebPage,sizeof(rootWebPage));
         n = n + sizeof(rootWebPage);
     } else {
@@ -622,7 +621,6 @@
 int tcpResponse(char * dataStart, int len)
 {
     int n=0; // number of bytes we have printed so far
-
     n=n+sprintf(n+dataStart,"Got %04d bytes.\n",len); // report the number of bytes received
     while( (n%4)!= 0) n=n+sprintf(n+dataStart,"*"); // insert spaces until n is exactly two away from a multiple of four
     if (v2) {
@@ -692,7 +690,7 @@
     int flagsOut = TCP_FLAG_ACK; // the default case is an ACK packet
     int flagsTCP = ((flagbitstcp[0]&1)<<8)|flagbitstcp[1]; // the tcp flags we received
 
-    windowsizetcp[0]=2; // tco window size = 700
+    windowsizetcp[0]=2; // tcp window size = 700
     windowsizetcp[1]=0xbc; // tcp windows size = 700
 
     int doFin = 0; // flag to see if we have to send an extra FIN message to shut down the link
@@ -853,7 +851,7 @@
 {
     debug("LCP Config ");
     if (ppp.pkt.buf[7] != 4) {
-        ppp.pkt.buf[4]=4; // allow only "no options" which means Maximum Receive Unit (MRU) is 1500 bytes
+        ppp.pkt.buf[4]=4; // allow only "no options" which means Maximum Receive Unit (MRU) is default 1500 bytes
         debug("Reject\n");
         send_pppFrame();
     } else {
@@ -982,6 +980,8 @@
 
 
 
+
+
 int main()
 {
     pc.baud(115200); // USB virtual serial port