Patient Clarification Needed - TCP Seq and Ack Numbers, Do I Have This Right?
Okay, for some reason I'll get my head around this and then I'll casually be reading something days later which makes me doubt I have really got this.
So yeah, if I just brain dump here and anyone feels like picking through it I'll be very grateful. :)
I did the following in MSPaint:
Packet 1>2 is "Hello! Pls talk to me, that ok?" SYN flag set. Seq and Ack did nothing yet.
Packet 2<3 is "OMG hi we can talk, that ok?" SYN and ACK flags set, Ack is 1 because that's the acknowledgement of that first packet.
Packet 3>4 is "OMG let's talk then!" ACK flag set, Ack is still 1, but that previous Ack=1 means Seq is now 1. No bigger as there's actually no 'data' just flags.
Packet 4<5 is "LOOL here's your first bunch of data!" which is 100 bytes in size.
Packet 5>6 (this is where I start to fall down) is "OMFG thanks. Here's some data for you. I need part 101 next" The Seq is STILL 1 at this point, but I'm not 100% on why... Anyway, the Ack is now 101 because the last packet it got was 100 bytes in length, so the 101 is saying "I got 100 bytes. That number of bytes I added to the previous Seq number, so this now shows you how many I got, by my new Ack number, which is the Seq number I need NEXT from you in the stream of stuff we're sending ."
Packet 6<7 "Okay, my Seq is 101. This means I'm recognising that I got your Ack of 101 last time. Also, my Ack is now 131, which means I got YOUR Ack of 101 and ALSO got 30 bytes in the last packet. AND TO BOOT HERE'S 200 bytes OF F-ING DATA!"
Packet 7>8 "Right, my Seq is 131 because that's what you wanted from your last Ack number. I got 200 bytes and added that to the last Ack number, so next I'll need part 331 of the sequence, so here's the Ack number 331. Oh and here is some data for YOU, to the tune of 20 bytes because we're windowing like retards here.
Packet 8>9 "Kewl, I'm replying with Seq=331 because that's what you wanted from your last Ack, I'm recognising your last packet in bytes plus your last Ack, to give me the Seq number of the NEXT thing I'll need which is my Ack=351, and here's your 100 bytes."
As you can see, I've TRIED to put it in plain English, but am I going wrong anywhere? If so, where?
Thanks for the help! :)