A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: tcp/tcp.cpp
- Revision:
- 22:914b970356f0
- Parent:
- 21:02c82594c8c0
- Child:
- 37:793b39683406
--- a/tcp/tcp.cpp Thu Jun 29 19:42:28 2017 +0000 +++ b/tcp/tcp.cpp Mon Jul 03 14:29:07 2017 +0000 @@ -250,24 +250,20 @@ seqnum = pTcb->locSeq; //Set the sequence number to the first byte of this message - ACK = true; //Send ACK RST = false; SYN = false; + PSH = false; - if (dataLength) + pTcb->locSeq += dataLength; //Record the next sequence number + + if (dataLength < mss) //If a part packet then there can be no more to send { - pTcb->locSeq += dataLength; //Record the next sequence number - PSH = false; - FIN = false; - } - else - { - pTcb->locSeq += 1; //Record the FIN - PSH = true; - FIN = true; + FIN = true; //Inform the client that we have no more to send after this + pTcb->locSeq += 1; //Record the FIN in the sequence pTcb->state = TCB_CLOSING; //Start closing } + pTcb->timer = now; return 1; }