In-Depth TCP/IP Protocol Suite Notes Textbook

TCP Basics

  • TCP (Transmission Control Protocol): Ensures reliable communication through segmenting data, acknowledgment of receipt, and retransmission of segments if necessary.

Sequence and Acknowledgment Numbers

  • Sequence Number: Each byte transmitted in TCP is assigned a unique sequence number, starting from a randomly generated initial value.

    • Example: For a file of 5000 bytes, if the first byte is 10,001, then bytes are numbered:
    • Segment 1: 10,001 to 10,001+999 (10,001-10,999)
    • Segment 2: 10,100 to 10,100+999 (10,100-11,099)
    • And so forth for 5 segments.
  • Acknowledgment Number: Indicates the next byte expected by the receiver. This number is cumulative.

TCP Connection and Segments

  • Connection-Oriented Protocol: TCP establishes a virtual connection before data transfer begins.
  • Segments: The packets in TCP are referred to as segments, and each segment has the following fields:
    • Source and destination port addresses (16 bits each)
    • Sequence number and acknowledgment number (32 bits each)
    • Header length, reserved bits, and checksum (varies in size)
    • Control flags (URG, ACK, PSH, RST, SYN, FIN)

TCP States and Flow Control

  • TCP State Transition Diagram: TCP operates through various states:
    • CLOSED: No connection exists.
    • LISTEN: Waiting for a SYN.
    • SYN-SENT: Waiting for ACK of a sent SYN.
    • ESTABLISHED: Connection is active; data transmission is ongoing.
    • FIN-WAIT-1/2, CLOSE-WAIT, TIME-WAIT: Various states during the termination phase.
  • Flow Control: Managed through send windows and receive windows to ensure data is sent at a manageable rate. Uses feedback for adjustments based on buffer availability.

Error Control

  • Reliability Mechanisms: TCP assures delivery of data through:
    • Checksum: Used for error checking.
    • Retransmission: Resends lost or corrupted segments.
    • Cumulative Acknowledgments: Acknowledges all bytes up to a certain number.

Congestion Control

  • Mechanisms: Uses open-loop (prevention) and closed-loop (reaction) mechanisms, including a congestion window that adjusts based on network conditions.
  • Algorithms: Slow start and congestion avoidance control the speed of data transmission to prevent network congestion.

TCP Headers and Options

  • The TCP header can include optional fields, max size 40 bytes:
    • 1-byte options: End of option list, no operation.
    • Multiple-byte options: Maximum segment size, window scale factor, timestamps, and Selective Acknowledgments (SACK).

Timers in TCP

  • Key Timers Utilized:
    • Retransmission timer: Resends packets if no acknowledgment received within a time limit.
    • Persistence timer: Ensures flow control window remains open.
    • Keepalive timer: Checks for broken connections by sending periodic messages.
    • TIME-WAIT timer: Ensures that segments are allowed to be processed before releasing resources.

Practical Examples

  • Understanding sequence numbers, acknowledgement methods, and transitioning states helps in grasping TCP operations.

  • SACK (Selective Acknowledgment): Allows a receiver to inform a sender about all the segments that have been received successfully, facilitating more efficient retransmissions.

Conclusion

  • Understanding TCP's sequence control, state management, flow control, error control, and congestion control is essential for grasping reliable data communication in IP networks.