TELNET and its brief description Telnet
NS2 provides implementation for the TELNET protocol and is instantiated by the program below
NS2 provides implementation for the TELNET protocol and is instantiated by the program below
set ns [new Simulator]
set trf [open 3.tr w]
$ns trace-all $trf
set naf [open tel.nam w]
$ns namtrace-all $naf
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$n0 label "Source/FTP"
$n1 label "Source/Telnet"
$n3 label "Destination/FTP/Telnet"
$ns color 1 "red"
$ns color 2 "red"
$ns duplex-link $n0 $n2 19Mb 10ms DropTail
$ns duplex-link $n1 $n2 10Mb 10ms DropTail
$ns duplex-link $n2 $n3 15Mb 10ms DropTail
set tcp0 [new Agent/TCP]
$ns attach-agent $n0 $tcp0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ftp0 set packetSize_ 500Mb
$ftp0 set interval_ 0.01
set sink3 [new Agent/TCPSink]
$ns attach-agent $n3 $sink3
set tcp1 [new Agent/TCP]
$ns attach-agent $n1 $tcp1
set telnet1 [new Application/Telnet]
$telnet1 attach-agent $tcp1
$telnet1 set packetSize_ 500Mb
$telnet1 set interval_ 0.01
$ns connect $tcp0 $sink3
$ns connect $tcp1 $sink3
proc finish { } {
global ns naf trf
exec nam tel.nam &
close $naf
close $trf
exit 0
}
$ns at o.3 "$ftp0 start"
$ns at 0.3 "$telnet1 start"
$ns at 10 "finish"
$ns run
No comments:
Post a Comment