Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Laborator 1

Tema: Studimi i performancs s TCP dhe UDP n rrjetat wired


Qellimi i ketij laboratori eshte simulimi i nje rrjeti ku bashke-ekzistojne trafiku TCP dhe multicast
UDP.

Shkruani nje skript tcl qe krijon topologjine e mesiperme


1 lidhje TCP
burimi nyja 9
destinacioni nyja 1
1 burim FTP source te lidhur tek agjenti tcp i nyjes 9
burimi FTP fillon ne kohen 0.2 second
1 lidhje Multicast UDP
perdor dense mode multicast routing
derguesi nyje 7
marresat: nyjet 0 dhe 2
1 burim CBR te lidhur tek agjenti udp i nyjes 7
burimi CBR fillon ne kohedn 0.2 second
dy marresit i bashkohen grupit ne kohen 0.0
Simuli perfundon ne kohen 1.5 second

Skripti ndihmes tcl


# Creating the core event scheduler
...PLOTESONI...
$ns color 1 red
$ns color 2 blue
# Creating 11 nodes
. ...PLOTESONI...
# Outputs nam traces
set nf [open out.nam w]
$ns namtrace-all $nf
# Creating 10 links
# All with bandwidth 10Mb, delay 10ms, and DropTail queue
# Except the bottleneck link with bw 1.5Mb, delay 20ms, and RED queue
...PLOTESONI...
# Set queue limit (buffer size) to 5 packets in the bottleneck link
$ns queue-limit $n(3) $n(4) ...PLOTESONI...
$ns queue-limit $n(4) $n(3) ...PLOTESONI...
# Set link orientation for nam
$ns duplex-link-op $n(0) $n(3) orient right-down
$ns duplex-link-op $n(1) $n(3) orient right
$ns duplex-link-op $n(2) $n(3) orient right-up
$ns duplex-link-op $n(3) $n(4) orient right
$ns duplex-link-op $n(4) $n(5) orient right-up
$ns duplex-link-op $n(4) $n(6) orient right-down
$ns duplex-link-op $n(5) $n(7) orient right-up
$ns duplex-link-op $n(5) $n(8) orient right
$ns duplex-link-op $n(6) $n(9) orient right
$ns duplex-link-op $n(6) $n(10) orient right-down
# Set queue position for nam
$ns duplex-link-op $n(3) $n(4) queuePos -0.5
$ns duplex-link-op $n(4) $n(3) queuePos -0.5
# Set multicast routing to dense mode
...PLOTESONI...

# Create a TCP connection from node 9 to node 1


. ...PLOTESONI...
$tcp set class_ 1
$tcp set window_ 20

# Create an FTP source and attach it to the TCP connection


...PLOTESONI...
# Create a UDP connection from node 7 to a multicast group
...PLOTESONI...
$udp set class_ 2
# Create a CBR source and attach it to the UDP connection
...PLOTESONI...
# Create dummy receivers and attach them to the receiving nodes
set rcvr0 [new Agent/Null]
$ns attach-agent $n(0) $rcvr0
set rcvr1 [new Agent/Null]
$ns attach-agent $n(2) $rcvr1
# Schedule events to happen
...PLOTESONI...

# A finish proc to flush traces and out call nam


proc finish {} {
global ns nf
$ns flush-trace
close $nf
puts "running nam..."
exec nam out.nam &
exit 0
}
# Start the event scheduler
$ns run

You might also like