RealtimeCompLab2

Dependencies:   mbed

Fork of PPP-Blinky by Nicolas Nackel

Revision:
30:273431bccb02
Parent:
29:30de79d658f6
Child:
31:e000c1b9c565
--- a/main.cpp	Wed Jan 04 23:52:46 2017 +0000
+++ b/main.cpp	Thu Jan 05 02:00:04 2017 +0000
@@ -538,13 +538,13 @@
     
     // Ok, we are done with figuring out the flags. Now we start preparing to respond
     
-    //flagbitstcp[1] = TCP_FLAG_ACK; // if we hare here we have to ack
     int temp = ack;
-    ack = seq + incomingLen; // acknowledge the number of bytes they sent
-    ppp.seq = temp; // adopt their idea of our sequence
+    ack = seq + incomingLen; // acknowledge the number of bytes they sent by adding it to seq
+    ppp.seq = temp; // adopt their calculation of our sequence number
     seq = ppp.seq;
     // let's check incoming text for an HTTP home page GET request
     if ( strncmp(dataStart, "GET / HTTP/1.1", 14) == 0) {
+        flagbitstcp[1] = TCP_FLAG_FIN; // close connection after delivering page
         dataLen = 15*32; // this block has to hold the web page below, but keep it under 1k
         memset(dataStart,'x', dataLen ); // initialize the block
         int n=0; // number of bytes we have printed so far