Lab2_web / Mbed 2 deprecated webserverBlinky

Dependencies:   mbed

Fork of webserverBlinky by RealTimeCompLab2

Revision:
91:5141ae9fba53
Parent:
90:55e0f243a7ce
Child:
92:cb962b365cce
diff -r 55e0f243a7ce -r 5141ae9fba53 main.cpp
--- a/main.cpp	Sun Jul 23 00:23:49 2017 +0000
+++ b/main.cpp	Sun Jul 23 06:50:57 2017 +0000
@@ -17,13 +17,12 @@
 
 // Handy tools
 // https://ttssh2.osdn.jp/index.html.en - Tera Term, a good terminal program to monitor the debug output from the second serial port with!
-// Wireshark - can't monitor Dial-Up network packets on windows, but useful - can import our dumpFrame routine's hex output
-// Microsoft network monitor - real-time monitoring of all our packets
+// https://www.microsoft.com/en-us/download/details.aspx?id=4865 - Microsoft network monitor - real-time monitoring of PPP packets - 
 // http://pingtester.net/ - nice tool for high rate ping testing
 // http://www.sunshine2k.de/coding/javascript/crc/crc_js.html - Correctly calculates the 16-bit FCS (crc) on our frames (Choose CRC16_CCITT_FALSE)
-// The curl.exe program in Windows Powershell - use it like this to stress test the webserver: while (1) { curl 172.10.10.1 }
 // https://technet.microsoft.com/en-us/sysinternals/pstools.aspx - psping for fast testing of ICMP ping function
 // https://eternallybored.org/misc/netcat/ - use netcat -u 172.10.10.1 80 to send/receive UDP packets from PPP-Blinky
+// Windows Powershell invoke-webrequest command - use it to stress test the webserver like this:  while (1){ invoke-webrequest -uri 172.10.10.1/x }
 
 #include "mbed.h"
 
@@ -662,6 +661,9 @@
     int dataLen = 0; // most of our responses will have zero TCP data, only a header
     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]=3; // ignore window size negotiation
+    windowsizetcp[1]=0; // ignore winodw size negotiation
 
     // A sparse TCP flag interpreter that implements simple TCP connections from a single source
     // Clients are allowed ONE push packet, after which the link is closed with a FIN flag in the ACK packet
@@ -675,6 +677,7 @@
             break;
         case TCP_FLAG_ACK | TCP_FLAG_PSH:
             flagsOut = TCP_FLAG_ACK | TCP_FLAG_FIN; // for every push we answer once AND close the link
+            windowsizetcp[0]=1; // reduce the receive window size even more
             if ( strncmp(tcpDataIn, "GET ", 4) == 0) { // check for an http GET command
                 dataLen = httpResponse(tcpDataOut); // send an http response
             }
@@ -704,9 +707,6 @@
     memcpy(srctcp, dsttcp,2);
     memcpy(dsttcp, tempHold,2); // swap ip port source/dest
 
-    windowsizetcp[0]=4; // ignore window size negotiation
-    windowsizetcp[1]=0; // ignore winodw size negotiation
-
     acktcp[0]=ack_out>>24;
     acktcp[1]=ack_out>>16;
     acktcp[2]=ack_out>>8;