Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

#Open the Trace files set file1 [open out.tr w] set winfile [open WinFile w] $ns trace-all $file1 #Define a ‘finish’ procedure proc finish {} { global ns file1 $ns flush-trace close $file1 exec nam out.nam & exit 0 } set n1 [$ns node] set

puts "Hello World!"
#Open the Trace files
set file1 [open out.tr w] set winfile [open WinFile w] $ns trace-all $file1
#Define a ‘finish’ procedure
proc finish {} {
global ns file1
$ns flush-trace
close $file1
exec nam out.nam &
exit 0
}
set n1 [$ns node] set n2 [$ns node] set lan [$ns newLan “$n1 $n2” 1Mb 40ms LL Queue/DropTail MAC/Csma/Cd
Channel] set tcp [new Agent/TCP/Newreno] $ns attach-agent $n1 $tcp
set sink [new Agent/TCPSink/DelAck] $ns attach-agent $n2 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
$tcp set window_ 65536
$tcp set packetSize_ 1024

#Setup a FTP over TCP connection
set ftp [new Application/FTP] $ftp attach-agent $tcp
$ftp set type_ FTP

proc get_throughput { tcp } {
#now calculate the average throughtput (in Mb/s)
puts “[expr [$tcp set ndatapack_]*8.0/1000/124]Mb/s”
}
$ns at 1.0 “$ftp start”
$ns at 124.0 “$ftp stop”
$ns at 124 “get_throughput $tcp”
$ns at 125.0 “finish”
$ns run

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.