0% found this document useful (0 votes)
23 views2 pages

CN

The document sets up a network simulation with four nodes connected by links and simulates TCP and UDP traffic between the nodes. It creates agents, attaches them to nodes, connects applications to the agents, and schedules events like starting/stopping the traffic at certain times.

Uploaded by

Montana Jones
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

CN

The document sets up a network simulation with four nodes connected by links and simulates TCP and UDP traffic between the nodes. It creates agents, attaches them to nodes, connects applications to the agents, and schedules events like starting/stopping the traffic at certain times.

Uploaded by

Montana Jones
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

set ns [new Simulator]

$ns color 1 Blue


$ns color 2 Red
set tracefile [open out.tr w]
$ns trace-all $tracefile

set nf [open out.nam w]


$ns namtrace-all $nf

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n3 1Mb 10ms DropTail

set tcp [new Agent/TCP]


$ns attach-agent $n0 $tcp

set tcpsink [new Agent/TCPSink]


$ns attach-agent $n3 $tcpsink
$ns connect $tcp $tcpsink
$tcp set fid_ 1

set ftp [new Application/FTP]


$ftp attach-agent $tcp

set udp [new Agent/UDP]


$ns attach-agent $n1 $udp

set null0 [new Agent/Null]


$ns attach-agent $n3 $null0
$ns connect $udp $null0
$udp set fid_ 2

set cbr [new Application/Traffic/CBR]


$cbr attach-agent $udp

proc finish {} {
global ns tracefile nf
$ns flush-trace
close $nf
close $tracefile
exec nam out.nam &
exit 0
}

$ns at 1.0 "$ftp start"


$ns at 4.0 "$ftp stop"
$ns at 1.0 "$cbr start"
$ns at 4.0 "$cbr stop"

$ns at 5.0 "finish"

$ns run

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy