RealtimeCompLab2
Dependencies: mbed
Fork of PPP-Blinky by
Diff: main.cpp
- Revision:
- 65:23b17c43aa0f
- Parent:
- 64:677b9713a120
- Child:
- 66:f005b9fdf4d1
--- a/main.cpp Sun Jun 04 21:16:50 2017 +0000 +++ b/main.cpp Sun Jun 04 21:26:17 2017 +0000 @@ -621,15 +621,13 @@ // Now we have to recalculate all the header sizes, swap IP address/port source and destination, and do the IP and TCP checksums - char tempHold[12]; + char tempHold[12]; // it's 12 long because we later reuse it when building the TCP pseudo-header memcpy(tempHold, srcAdr,4); - memcpy(tempHold+4, dstAdr,4); - memcpy(srcAdr, tempHold+4,4); + memcpy(srcAdr, dstAdr,4); memcpy(dstAdr, tempHold,4); // swap ip address source/dest memcpy(tempHold, srctcp,2); - memcpy(tempHold+2, dsttcp,2); - memcpy(srctcp, tempHold+2,2); + memcpy(srctcp, dsttcp,2); memcpy(dsttcp, tempHold,2); // swap ip port source/dest ack = seq + incomingLen; // acknowledge the number of bytes that they sent by adding it to "our" sequence number