Traffic control is achieved in the internet using efficient algorithms such as Additive Increase Multiplicative Decrease (AIMD) and Explicit Congestion Notification (ECN) in transport layer. AIMD.tcl file invokes the communication components in wired network using TCP and TCPSink and inbuilt congestion window tracing variable cwnd_ is traced out and stored in file cwnd.tr. Sending rate at the client (cwnd_) is adjusted dynamically based on the acknowledgment received from the end server.
# Filename: AIMD.tcl
set tcp0 [new Agent/TCP]
$tcp0 set maxcwnd_ 16
$tcp0 set fid_ 1
$ns attach-agent $Client1 $tcp0
set sink0 [new Agent/TCPSink]
$ns attach-agent $Endserver1 $sink0
$ns connect $tcp0 $sink0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ns add-agent-trace $tcp0 tcp
$tcp0 tracevar cwnd_
$ns at 0.50 "$ftp0 start"
$ns at 30.5 "$ftp0 stop"
set tcp1 [new Agent/TCP]
$tcp1 set maxcwnd_ 16
$tcp1 set fid_ 2
$ns attach-agent $Client1 $tcp1
set sink1 [new Agent/TCPSink]
$ns attach-agent $Endserver2 $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns add-agent-trace $tcp1 tcp
$tcp0 tracevar cwnd_
$ns at 0.50 "$ftp1 start"
$ns at 30.5 "$ftp1 stop"
Data flow
Adjusted cwnd information in cwnd.tr file