set ns_ [new Simulator] set nf [open out.nam w] $ns_ namtrace-all $nf proc finish {} { global ns_ nf $ns_ flush-trace close $nf exec nam out.nam & exit 0 } set node_(s1) [$ns_ node] set node_(k1) [$ns_ node] $ns_ duplex-link $node_(s1) $node_(k1) 1Mb 10ms DropTail # set up connection (do not use "create-connection" method because # we need a handle on the sink object) set src [new Agent/TCP/FullTcp] # create agent; set sink [new Agent/TCP/FullTcp] # create agent; $ns_ attach-agent $node_(s1) $src # bind src to node; $ns_ attach-agent $node_(k1) $sink # bind sink to node; $src set fid_ 0 # set flow ID field; $sink set fid_ 0 # set flow ID field; $ns_ connect $src $sink # active connection src to sink; set telnet [new Application/Telnet] #$cbr0 set packetSize_ 500 #$cbr0 set interval_ 0.005 $telnet attach-agent $src set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 500 $cbr1 set interval_ 0.005 $cbr1 attach-agent $sink # set up TCP-level connections $sink listen # will figure out who its peer is; $src set window_ 100; #$src listen $ns_ at 0.0 "$telnet start" #$ns_ at 1.0 "$cbr1 start" $ns_ at 5 "finish" $ns_ run