Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of webserverBlinky by
Diff: main.cpp
- Revision:
- 33:b5a86ff03f3d
- Parent:
- 32:512228c29209
- Child:
- 34:8a6fbc73a7f1
--- a/main.cpp Thu Jan 05 02:59:17 2017 +0000 +++ b/main.cpp Thu Jan 05 03:23:18 2017 +0000 @@ -514,8 +514,10 @@ int incomingLen = dataLen; // remember length of incoming packet dataLen = 0; // most of our responses will have zero TCP data, only a header - - if ( ((flagsTCP & ~TCP_FLAG_ACK) == 0) && ((flagsTCP & TCP_FLAG_ACK) != 0) ) { + + if ( ((flagsTCP & TCP_FLAG_FIN) != 0) && ((flagsTCP & TCP_FLAG_ACK) != 0) ) { + return; // ACK and FIN - we are done + } else if ( ((flagsTCP & ~TCP_FLAG_ACK) == 0) && ((flagsTCP & TCP_FLAG_ACK) != 0) ) { if (incomingLen > 0) { // they sent data in the ack ack = seq + incomingLen; // acknowledge the number of bytes they sent seq = ppp.seq; // confirm our current sequence position @@ -550,7 +552,7 @@ memset(dataStart,'x', dataLen ); // initialize the block int n=0; // number of bytes we have printed so far n=n+sprintf(n+dataStart,"HTTP/1.1 200 OK\r\nServer: PPP-Blinky\r\n"); // http header - n=n+sprintf(n+dataStart,"Content-Length: 378\r\n"); // http header + n=n+sprintf(n+dataStart,"Content-Length: 377\r\n"); // http header n=n+sprintf(n+dataStart,"Content-Type: text/html; charset=us-ascii\r\n\r\n"); // http header int nHeader=n; // byte total of all headers n=n+sprintf(n+dataStart,"<html><head><title>mbed-PPP-Blinky</title><script>window.onload=function()"); // html