What is the meaning of the SYN and ACK numbers in the TCP protocol?

Hello. I don't understand what SYN and ACK mean when establishing a TCP connection. I watched a lot of videos and didn't understand them. Who figured it out? What is the point of these SYN and ACK (why did they even come up with them)? Some incomprehensible numbers are exchanged between computers, some SYN increments per unit... We need some simple example that is understandable for someone who does not understand networks at all.

 3
Author: Dimon, 2016-09-15

1 answers

They were invented for the important purpose that packets transmitted over TCP may not arrive in the same sequence as they were sent and not in the same composition. We need a mechanism that will allow us to collect a set of received packets in the correct sequence. And at the same time, check whether all the packages are present or someone went off the track halfway and got lost.

This problem is solved with the help of queue numbers and confirmation numbers. Queue numbers (sequence numbers) - they simply number the packets being sent. This number increases depending on the length of the data field. Each data octet (i.e., each byte) of a single packet has its own queue number. The queue number of the first data octet is transmitted in the TCP header of the packet, and it is also considered the queue number for the packet. Confirmation numbers - tell the other party the number of the queue that is expected to be received from it next. They say packets with all the previous queue numbers (but not including this one) they have already been received.

The initial queue number is sent by the client when the connection is established, along with the SYN flag. In response, the server sends the confirmation number (the received queue number + 1) and its queue number (in general, any, but when using the SYN coockie mechanism built according to a certain algorithm). The server is currently telling the client that is waiting for a packet from it, which will have a queue number equal to the sent confirmation number. this number is used by the client in the future and is repelled.

Then everything happens in this way - one side (side A) sends the other (side B) packets numbered with queue numbers. The second party accepts them and reports the number of the queue that it expects to receive from A with the next packet. This indicates that side B received all packets whose queue number was lower than the transmitted confirmation number (but not equal to it) and that side B expects that in the next batch the numbering of the transmitted data will start from this number.

Just in case, once again - the TCP field Номер очереди (Порядковый номер) it simply means the number of the package, which is needed in order to properly assemble the packages and detect the loss (or duplicate). The Номер подтверждения field is used to inform the second party about which packets have already been received from it (with what sequence numbers) and contains the number that is expected to be seen in the Номер очереди field of the next received packet from the same source.

P. S. SYN and ACK are still flags, not numbers. They indicate that the corresponding header fields are involved (TCP flags)

 7
Author: МАН69К, 2016-09-16 09:06:23