How to Install TCP FACK.H Packages in Ns2
TO IMPORT TCP-FACK.H PACKAGES IN NS2 tool we have shared the required steps that will track you on the right direction. TCP-Fack, or Forward Acknowledgment, is a type of TCP that makes the usual congestion control methods better by improving how it finds and fixes lost packets. The tcp-fack.h file has the details for the TCP Fack class, which is based on the fast recovery method from TCP Reno. TCP Fack keeps track of the order of packets that have been received successfully using forward acknowledgment. This helps it to better understand how much data is still in the network. As a result, it can handle multiple lost packets more effectively during a single congestion situation. In NS-2, TCP Fack is especially helpful in cases where stronger congestion control is needed, particularly in high-bandwidth networks where several packets might get lost at once. This command sets up a TCP agent that uses the Fack method for managing congestion.
PRE-REQUISITES:
- Fresh installation of Ubuntu 16.04 LTS:
Screenshot:
2.NS-2.35 Installation:
Screenshot:
Here, Percentage (%) symbol Denotes the successful installation of the NS 2.35 Simulator.
Screenshot:
HEADER FILE VERIFICATION:
- Locate to the ns-2.35 folder:
Screenshot:
2.Create the Main.tcl file in the scratch folder:
Next we need to create the Main.tcl file by using text editor in the ns-2.35 folder.
Screenshot:
Next we need to paste the below code to the Main.tcl file and save the file in the ns-2.35 folder.
Code:
set ns [new Simulator]
proc build_topology { ns } {
global node_
set node_(s1) [$ns node]
set node_(s2) [$ns node]
set node_(r1) [$ns node]
set node_(r2) [$ns node]
set node_(s3) [$ns node]
set node_(s4) [$ns node]
$ns duplex-link $node_(s1) $node_(r1) 10Mb 2ms DropTail
$ns duplex-link $node_(s2) $node_(r1) 10Mb 6ms DropTail
$ns duplex-link $node_(r1) $node_(r2) 1.5Mb 20ms RED
$ns queue-limit $node_(r1) $node_(r2) 25
$ns queue-limit $node_(r2) $node_(r1) 25
$ns duplex-link $node_(s3) $node_(r2) 10Mb 4ms DropTail
$ns duplex-link $node_(s4) $node_(r2) 10Mb 5ms DropTail
$ns duplex-link-op $node_(s1) $node_(r1) orient right-down
$ns duplex-link-op $node_(s2) $node_(r1) orient right-up
$ns duplex-link-op $node_(r1) $node_(r2) orient right
$ns duplex-link-op $node_(r2) $node_(r1) queuePos 0.5
$ns duplex-link-op $node_(s3) $node_(r2) orient left-down
$ns duplex-link-op $node_(s4) $node_(r2) orient left-up
}
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
build_topology $ns
$ns color 0 yellow
$ns color 1 green
$ns color 2 red
$ns color 3 blue
$ns color 4 cyan
$ns color 5 magenta
# Create TCP Vegas agents
set tcp1 [$ns create-connection TCP/Fack $node_(s1) TCPSink $node_(s3) 0]
set tcp2 [$ns create-connection TCP/Fack $node_(s2) TCPSink $node_(s3) 1]
# Set properties for TCP Vegas agents
$tcp1 set window_ 15
$tcp1 set ecn_ 1
$tcp2 set window_ 15
$tcp2 set ecn_ 1
set ftp1 [$tcp1 attach-app FTP]
set ftp2 [$tcp2 attach-app FTP]
$ns add-agent-trace $tcp1 tcp1
$ns add-agent-trace $tcp2 tcp2
$ns monitor-agent-trace $tcp1
$ns monitor-agent-trace $tcp2
# Trace TCP Vegas congestion window
$tcp1 tracevar cwnd_
$tcp2 tracevar cwnd_
$ns at 0.0 “$ftp1 start”
$ns at 0.0 “$ftp2 start”
$ns at 10.0 “finish”
proc finish {} {
global ns f nf
$ns flush-trace
close $f
close $nf
exec nam out.nam &
exit 0
}
$ns run
Screenshot:
3.Open the Terminal:
Next, we need to launch the terminal by right clicking the mouse in the ns-2.35 location.
Screenshot
Screenshot:
4.NS-2.35 Configuration && Building Process:
Next, we need to configure and build the ns-2.35 folder to make the Created files need to work in ns-2.35 configuration.
Command: “./make”
Screenshot:
Screenshot:
Screenshot:
Here, NS-2.35 Building process completed successfully.
5.Importing Tcp-Fack.h:
Here we imported the Tcp-Fack.h header file code indirectly accessed the Tcp-Fack class used in the Tcl script (set tcp1 [$ns create-connection TCP/Fack $node_(s1) TCPSink $node_(s3) 0]) It creates TCP Fack agents (TCP/Fack) implements TCP Fack congestion control in this example program. Here we highlighted the code line that highlighted which is internally accessed Tcp-Fack.h, we will show class file that used in this code via TCP folder.
Screenshot:
Screenshot:
Here we will show the header file by opening Tcp-Fack.h file to show the class or function imported from the Tcp-Fack.h in the example code. Tcp-Fack.h is used (set tcp1 [$ns create-connection TCP/Fack $node_(s1) TCPSink $node_(s3) 0]) It creates TCP Fack agents (TCP/Fack), where tcp1 is connected between nodes s1 and s3, and tcp2 is connected between nodes s2 and s3 corresponds to creating an instance of FackTcpAgent, which implements TCP Fack congestion control during the simulation.
Screenshot:
Screenshot:
6.Executing the Example Program for Tcp-Fack Header:
Then we need to run the Example program for Tcp-Fack Header to view output of the program.
Command: “./ns Main.tcl”
Screenshot:
Here we shown the output of the example program by using Tcp-Fack.h.
Screenshot:
Screenshot:
Screenshot:
In the NS 2.35 Simulation Example Program, the Tcp-Fack.h Header file is successfully imported. Check out the ns2projects.com team for top-notch research tips in this field. We’ve laid out the steps to import TCP-FACK.H PACKAGES in NS2, so if you hit any snags along the way, just reach out to us and we’ll hook you up with the best research solutions.
.