COMPUTER NETWORK AND SECURITY

COMPUTER NETWORK NOTES 

TRANSMISSION CONTROL PROTOCOL(TCP)

TCP (Transmission Control Protocol) is a widely used transport layer protocol in the TCP/IP suite. It provides reliable, connection-oriented communication between devices on a network. Here are the key features of the TCP protocol:

  • Connection-oriented:
    • TCP is a connection-oriented protocol, meaning that it establishes a reliable connection before data transfer begins. A three-way handshake (SYN, SYN-ACK, ACK) is used to establish and confirm the connection between the communicating devices.
  • Reliability:
    • TCP ensures reliable data transfer. It uses acknowledgment and retransmission mechanisms to confirm the receipt of data and to recover lost or corrupted packets. This reliability is crucial for applications that require accurate and complete delivery of data, such as file transfers and web pages.
  • Ordered Data Delivery:
    • TCP guarantees the ordered delivery of data. Each segment has a sequence number, allowing the receiver to reconstruct the data in the correct order. This feature is important for applications that depend on the sequential nature of data, like file transfers.
  • Flow Control:
    • TCP implements flow control mechanisms to prevent the sender from overwhelming the receiver with data. It uses a sliding window protocol to regulate the rate of data transmission, ensuring efficient and fair use of network resources.
  • Congestion Control:
    • TCP is designed to adapt to network conditions and avoid congestion. It uses congestion control algorithms to adjust the transmission rate based on the perceived state of the network. This helps in maintaining network stability and preventing congestion collapse.
  • Full-Duplex Communication:
    • TCP supports full-duplex communication, allowing data to be transmitted in both directions simultaneously. This is achieved by using separate communication channels for data sent in each direction.
  • Multiplexing and Demultiplexing:
    • TCP uses port numbers to distinguish between different applications running on the same device. This allows for the multiplexing of multiple application data streams into a single TCP connection and the demultiplexing of received data to the appropriate application.
  • Connection Termination:
    • TCP employs a four-way handshake to gracefully terminate a connection. This ensures that both sides are aware that the connection is closing and allows for the exchange of any remaining data before the connection is fully closed.
  • Checksum for Error Detection:
    • TCP includes a checksum field in its header to detect errors in the transmitted data. The receiving end checks the checksum to verify the integrity of the received data.
  • Byte-Oriented:
    • TCP is a byte-oriented protocol, meaning that it transmits data as a stream of bytes. The sender breaks down data into bytes, and the receiver reassembles these bytes into the original data.


 

 

  • Source Port (16-bits)  - It identifies source port of the application process on the sending device.
  • Destination Port (16-bits) - It identifies destination port of the application process on the receiving device.
  • Sequence Number (32-bits) - Sequence number of data bytes of a segment in a session.
  • Acknowledgement Number (32-bits)  - When ACK flag is set, this number contains the next sequence number of the data byte expected and works as acknowledgement of the previous data received.
  • Data Offset (4-bits)  - This field implies both, the size of TCP header (32-bit words) and the offset of data in current packet in the whole TCP segment.
  • Reserved (3-bits)  - Reserved for future use and all are set zero by default.
  • Flags (1-bit each)-  Flags are used to indicate a particular state of connection or to provide some additional useful information like troubleshooting purposes or to handle a control of a particular connection. Most commonly used flags are “SYN”, “ACK” and “FIN”. Each flag corresponds to 1 bit information.
  • Windows Size - This field is used for flow control between two stations and indicates the amount of buffer (in bytes) the receiver has allocated for a segment, i.e. how much data is the receiver expecting.
  • Checksum - This field contains the checksum of Header, Data and Pseudo Headers.
  • Urgent Pointer - It points to the urgent data byte if URG flag is set to 1.
  • Options - It facilitates additional options which are not covered by the regular header. Option field is always described in 32-bit words. If this field contains data less than 32-bit, padding is used to cover the remaining bits to reach 32-bit boundary.
  • Data - Contains the actual payload or data being transmitted.