set ns [new Simulator] set f [open out.tr w] $ns trace-all $f set nf [open out.nam w] $ns namtrace-all $nf set n(0) [$ns node] set n(1) [$ns node] set n(2) [$ns node] $ns duplex-link $n(0) $n(1) 1Mb 1ms DropTail set tcp [new Agent/TCP] $ns attach-agent $n(1) $tcp set ftp [new Application/FTP] $ftp attach-agent $tcp $ns duplex-link $n(1) $n(2) 1Mb 1ms DropTail $ns duplex-link $n(2) $n(0) 1Mb 1ms DropTail set tcpsink [new Agent/TCPSink] $ns attach-agent $n(0) $tcpsink $ns connect $tcp $tcpsink proc finish {} { global ns nf $ns flush-trace close $nf puts "running nam......" exec nam out.nam & exit 0 } $ns at 2.5 "finish" $ns run