telecom • networking • design

an blog

1 Comment

TCP fast retransmit and recovery

TCP Slow Start and Congestion Avoidance lower the data throughput drastically when segment loss is detected. Fast Retransmit and Fast Recovery have been designed to speed up the recovery of the connection, without compromising its congestion avoidance characteristics.

Fast Retransmit and Recovery detect a segment loss via duplicate acknowledgements. When a segment is lost, TCP at the receiver will keep sending ack segments indicating the next expected sequence number. This sequence number would correspond to the lost segment. If only one segment is lost, TCP will keep generating acks for the following segments. This will result in the transmitter getting duplicate acks (i.e. acks with the same ack sequence number)

Click here for TCP fast retransmit and recovery sequence diagrams

TCP fast retransmit

The transmitter acts on duplicate acks and retransmits the packet, without waiting for the segment timer expiry

TCP fast recovery

TCP maintains the current data flow

Click here for TCP fast retransmit and recovery sequence diagrams

Leave a comment

TCP congestion avoidance flow

We have already seen that TCP connection starts up in slow start mode, geometrically increasing the congestion window (cwnd) until it crosses the slow start threshold (ssthresh). Once cwnd is greater that ssthresh, TCP enters the congestion avoidance mode of operation. In this mode, the primary objective is to maintain high throughput without causing congestion. If TCP detects segment loss, it assumes that congestion has been detected over the internet. As a corrective action, TCP reduces its data flow rate by reducing cwnd. After reducing cwnd, TCP goes back to slow start.

We examine congestion avoidance in detail. We examine in detail how TCP reacts to the loss of a segment. The changes to the congestion window and the transition into slow start are covered in detail.

TCP congestion avoidance sequence diagram

1 Comment

TCP slow start sequence diagrams

TCP is an end to end protocol which operates over the heterogeneous Internet. TCP has no advance knowledge of the network characteristics, thus it has to adjust its behavior according to the current state of the network. TCP has built in support for congestion control. Congestion control ensures that TCP does not pump data at a rate higher than what the network can handle.

In this sequence diagram we will analyze “Slow start”, an important part of the congestion control mechanisms built right into TCP. As the name suggests, “Slow Start” starts slowly, increasing its window size as it gains confidence about the networks throughput.

TCP slow start overview

An overview of TCP slow start.

TCP slow start with socket level details

A detailed look at TCP slow start with socket level state transition details.

Analyze TCP slow start from the server point of view

A sequence diagram describing the slow start with a focus on server end interactions.

Client focused view of the slow start

A final look at slow start. This time with a focus on the client side.

1 Comment

TCP 3-way handshake based setup and connection release

TCP (Transmission Control Protocol) provides a reliable end to end service that delivers packets over the Internet. Packets are delivered in sequence without loss or duplication.

This sequence diagram explores following:

  1. The three-way handshake to establish a TCP
  2. Data transfer using the byte oriented sequence numbers
  3. Release of a TCP connection.

TCP connection setup and release sequence diagram

The TCP connection 3-way set and release is discussed with focus on socket setup and release.

High level flow of a TCP connection

Socket level details are hidden. Get a high level view of the interactions.

Server socket level view of the TCP connection

Just focus on the server socket handling of a TCP connection.

Client socket interactions in a TCP connection

Focus on the client socket level interactions.

TCP connection context diagram

Examine the relationship between different entities involved in a TCP connection.

Leave a comment

FTP File Transfer Protocol Sequence Diagram

Here we explore the sequence of interactions in a typical FTP (File Transfer Protocol) session. The example here illustrates the use of multiple TCP connections by FTP. We will cover how FTP establishes a telnet TCP connection (TCP Port 21) to control the overall flow of the FTP transfer.

Then we examine the use of TCP Port 20 for establishing TCP connections for directory transfer and file retrieval.

The complete sequence diagram can be divided into the following steps:

  • DNS Query to obtain the IP address for the FTP Server
  • FTP Telnet connection setup and login. (USER and PASS commands)
  • Obtaining a directory listing (PORT and LIST command)
  • Changing directory (CWD command)
  • Downloading a file using FTP get (PORT and RETR command)

These phases are analyzed with sequence diagrams and context diagrams that provide multiple views of the FTP interactions.

FTP protocol sequence diagram

FTP High Level Overview

FTP control port (TCP port 21) handling

FTP data port (TCP port 20) handling

FTP context diagram

Leave a comment

ROHC – Robust Header Compression

ROHC improves the throughput on the link by compressing the TCP, UDP, IP and RTP headers to a a few bytes. This is particularly important for voice over IP as in absence of ROHC, the headers would have consumed more bandwidth than the voice channel being carried.

ROHC is envisioned as an extensible framework for robust and efficient header compression over highly error–prone links with long round–trip times. This design is motivated by the large bit error rates (typically on the order of 10−4 – 10−2) and long round trip times (typically 100–200 msec) of cellular networks. The design of ROHC is based on the experiences from the header compression schemes reviewed above. In particular, ROHC incorporates elements from ROCCO and Adaptive Header Compression (ACE) which may be viewed as a preliminary form of ROHC.


Leave a comment

TCP/IP Tutorial and Technical Overview IBM Redbook

Free TCP/IP book from IBM:

Part 1. Core TCP/IP protocols
Chapter 1. Architecture, history, standards, and trends
Chapter 2. Network interfaces
Chapter 3. Internetworking protocols
Chapter 4. Transport layer protocols
Chapter 5. Routing protocols
Chapter 6. IP multicast
Chapter 7. Mobile IP
Chapter 8. Quality of service
Chapter 9. IP version 6
Chapter 10. Wireless IP

Part 2. TCP/IP application protocols
Chapter 11. Application structure and programming interfaces
Chapter 12. Directory and naming protocols
Chapter 13. Remote execution and distributed computing
Chapter 14. File-related protocols
Chapter 15. Mail applications
Chapter 16. The Web
Chapter 17. Network management
Chapter 18. Wireless Application Protocol
Chapter 19. Presence over IP

Part 3. Advanced concepts and new technologies
Chapter 20. Voice over Internet Protocol
Chapter 21. Internet Protocol Television
Chapter 22. TCP/IP security
Chapter 23. Port based network access control
Chapter 24. Availability, scalability, and load balancing
Appendix A. Multiprotocol Label Switching

IBM TCP/IP Redbook