TCP Connection establishment and termination
TCP is one of theTCP is connection oriented protocol and reliable protocol. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error-checked delivery of a stream of octets between applications running on hosts communicating over an IP network. Major Internet applications such as the World Wide Web, email, remote administration, and file transfer rely on TCP.
TCP Services:
1. The process to Process communication: TCP follows the process to process delivery of segments just like Data Link layer provides Node to Node delivery; Network layer is responsible for delivery of datagrams between two hosts. This is called host-to-host delivery.
TCP, unlike UDP, allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes due to connection-oriented transfer. It seems like an imaginary tube has been created to transfer the data.
2. TCP, unlike UDP, allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes due to connection-oriented transfer. It seems like an imaginary tube has been created to transfer the data.
3. Sending and receiving buffers: As the data received may not be able to get absorbed at the receiving side at a given speed, therefore, we make use of buffers to store the data temporarily.
4. Connection-Oriented Service: TCP first establishes a connection with the receiver and then transfer the data unlike UDP which does not require a connection, simply delivers the data whether it has reached in its original for or not (data loss).
5. Reliable connection: As TCP establishes a connection first, it makes sure that the packets reach safely and in the sequence to the receiver, therefore, it is considered to be reliable.
TCP Features
1. Byte Number: TCP numbers all data bytes. A random number is allocated between 0 to 2^32-1 for the number of the first byte.
2. Sequence number: After all bytes are numbered, TCP assigns the sequence number to each segment being sent. The sequence number is the first-byte number being carried in the segment.
3. Acknowledgement Number:
a) Flow Control: TCP makes sure that the rate at which data is being transferred matches the amount of data receiver can absorb. also, if traffic is detected in the network, TCP plays the role of data flow controller.
b) Error Control: This mechanism is performed through the technique called Checksum. through this technique, TCP makes sure that the data received does not contain any erroneous data or missing segment.
c) Congestion Control: Congestion control. Congestion control controls traffic entry into a telecommunications network, to avoid congestive collapse by avoiding oversubscription by reducing the rate of packets. It should not be confused with flow control, which prevents the sender from overwhelming the receiver.
Now, let us talk about TCP fragment format.
1. The segment consists of 20-60 byte header depending upon the presence of Options. Header fields.
2. Source port address.
3. Destination port address.
4. Sequence number: This 32-bit field defines the number assigned to the first byte of data contained in this segment
5.Acknowledgment number: This 32-bit field defines the byte number that receiver of the segment is expecting next
6. Header length: it’s a 4-bit field.
7. Reserved: for future use.
8. Control: defined 6 different control bits or flags.
Flag Description
1. URG: The value of the urgent field is valid.
2. ACK (Acknowledgment); The value of ACK bit is valid.
3. PSH: Push the data.
4. RST: The connection must be reset.
5. SYN: Synchronize sequencing numbers during connection.
6. FIN: Terminate the connection
9. Window size: this field defines the size of the window in bytes that other party should maintain. Length is 16 bit. The receiver dictates the size decision.
10. Checksum: size 16 bit. Same as UDP.
11. Urgent pointer: 16-bit pointer is used when the segment has urgent data.
12. Options: we have 40 bytes of optional data which could be present or not.
TCP Connection: Three-way handshake
1. When server is ready to accept request, it sends the request to TCP and is called passive open.
2. The client machine request active open.
3. TCP now starts the three-way handshaking process.
4. There are three steps to be followed:
a) A client sends SYN segment in which only SYN flag is set, this for synchronization of the sequence number. When the data transfer starts, it consumes one sequence number. It takes imaginary 1-byte.
b) The server sends SYN+ACK segments, SYN for communication from other direction and serves as the acknowledgment for SYN segment, consumes 1 sequence number.
c) The client sends just ACK segment to acknowledge the receipt of second segment with ACK flag and number. It does not consume any sequence number.
5. Push operation: There is some data which needs to be sent immediately for that PUSH bit is set. This means that there should not be any delay while sending the data.
6. Urgent data: On occasion application program needs to send the urgent bytes. This means that sending application program wants a piece of data to be read out of order by the receiver.
Connection Termination
1.The client after receiving a close command from client process, sends the first segment, a FIN segment in which the FIN flag is set.
2.The server TCP after receiving the FIN segment informs it process of the situation and sends the second segment, FIN+ACK segment.
3.The client TCP sends the last segment, an ACK segment to confirm the receipt of the FIN segment from the TCP server.
Here, we presented an extended knowledge over TCP three-way handshake which generally creates confusion for the readers. The above-given description clears away confusion web and provides relevant information on the given topic.