What is TCP? How does it work?
TCP stands for ‘Transmission Control Protocol’ and TCP is one of the two original components of the suite, complementing the Internet Protocol (IP). This Protocol provides point to point connection meaning one sender, one receiver. TCP is reliable, in-order byte steam and gives no “message boundaries”. TCP provide a pipeline that control the congestion and flow control set window size. See image.
TCP is a full duplex data flow that permits a bi-directional data, meaning that data is flow back and forwards in the same connection, and is also connection-oriented using handshaking proses starting by init’s sender and the receiver state before data exchange start. See Image.
TCP have many cool controls, like the flow control. The flow controls watch out for the sender will not overwhelm receiver therefore you will get less errors in the data transfer.
A packet that is sends with a TCP protocol is divided in smaller packets that are called chunks, that form the ‘segment’s’ of size MSS(Maximum segment size) that limits the maximum size of the segment´s data field. Segment consists of a header and a data field. Two of the most important fields in TCP segments are the sequence number field and the acknowledgment number field. The sequence number that the segment gets is the byte-stream number of the first byte in the segments. Example if a user is sending a steam of data to a another user the data is put in segments be for its sends, and each segments gets is own sequence number, when the data arrive to the receiver the chunks is put together in the right order, and if is missing a chunk there is send a another request to get the missing chunk in the data transfer.
How a segment is structure you can see in the images below.
To get more information about TCP and how it works check out the internet or the book Computer Networking, A top-down approach.
Written by : Alexander I Ólafsson