17 June 2014

TCP Congestion Control

Congestion control is one of the performance metrics of TCP protocol. There are so many TCP Versions to control congestion in the network.
NS2 also supports various TCP protocols like TCP Vegas, TCP Reno, TCP, TCP Sack, Full TCP, TCP linux, etc.

Each TCP protocols has different mechanism in controlling the congestion. Some are good at Congestion control, some are good at error ands flow control.

Before understanding the congestion control, one has to know the congestion window of TCP. TCP has a congestion window (cwnd_ in ns2), this variable affects or predicts the congestion control.

The value assigned to this variable will alter the congestion control. Here are the files that are of prime importance before dealing with congestion control.
~ns-2.35/tcp/tcp.cc 
~ns-2.35/tcp/tcp.h 
~ns-2.35/tcl/lib/ns-default.tcl (In this file, the constant values for all the protocols in ns2 are set)

For example, the packet size of CBR is 210 by default, this value is represented like this in the ns-default.tcl file.

Application/Traffic/CBR set packetSize_ 210 

if you want to change the packet size of CBR for ns2, you may change the above line to

Application/Traffic/CBR set packetSize_ 500 

which is set to 500 bytes, the above line will affect the entire tcl scripts (the value is changed to 500), instead the packet size can be changed within the TCL file where it is programmed as given below

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 500
The above line will change the packet size for this file only. Similarly, the TCP congestion window is set like this
Agent/TCP set cwnd_ 0 

the default value is 0 and you may modify this within the file as given below
set tcp [new Agent/TCP]
$tcp set cwnd_ 3


To know more about congestion control, please see the video given below for detailed instructions. 



T S Pradeep Kumar