Ping

You might also like

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

EXNO:14 30-3-2012 ping.

tcl

PING PROGRAM

A.JAYALAKSHMI 2950017

set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail Agent/Ping instproc recv {from rtt} { $self instvar node_ puts "node [$node_ id] received ping answer from \ $from with round-trip-time $rtt ms." } set p0 [new Agent/Ping] $ns attach-agent $n0 $p0 set p1 [new Agent/Ping] $ns attach-agent $n2 $p1 $ns connect $p0 $p1 $ns at 0.2 "$p0 send" $ns at 0.4 "$p1 send" $ns at 0.6 "$p0 send" $ns at 0.6 "$p1 send" $ns at 1.0 "finish" $ns run

OUTPUT [student@it8 ~]$ ns ping.tcl node 0 received ping answer from node 2 received ping answer from node 0 received ping answer from node 2 received ping answer from

2 0 2 0

with with with with

round-trip-time round-trip-time round-trip-time round-trip-time

42.0 42.0 42.0 42.0

ms. ms. ms. ms.

EXNO:14 30-3-2012

FTP OVER TCP

A.JAYALAKSHMI 2950017

ftp.tcl set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns tracefile nf $ns flush-trace close $nf close $tracefile exec nam out.nam & exit 0 } set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail set tcp0 [new Agent/TCP] $ns attach-agent $n0 $tcp0 set ftp0 [new Application/FTP] $ftp0 attach-agent $tcp0 set tcpsink0 [new Agent/TCPSink] $ns attach-agent $n1 $tcpsink0 $ns connect $tcp0 $tcpsink0 $ns at 0.5 "$ftp0 start" $ns at 3.0 "finish" $ns run
OUTPUT:

You might also like