# a cbr source with an udp agent # I estimate flow between 3 and 4 Mb # My calculation gave me 0.8 or 0.44Mb, wether time to send one packet is included # or not in cbr interval time between two packets set ns [new Simulator] set nam_file [open test.out.nam w] set trace_file [open test.out.tr w] $ns namtrace-all $nam_file $ns trace-all $trace_file proc finish {} { global nam_file trace_file close $nam_file close $trace_file exec nam test.out.nam & exit 0 } #nodes and links set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail # in the next line, a bw of 0.34Mb is ok # the queue grows with 0.33Mb $ns duplex-link $n1 $n2 0.34Mb 10ms DropTail $ns duplex-link-op $n1 $n2 queuePos 0.5 #Sources set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 #Agents set udp0 [new Agent/UDP] set null2 [new Agent/Null] $ns attach-agent $n2 $null2 $ns attach-agent $n0 $udp0 $cbr0 attach-agent $udp0 #Connections $ns connect $udp0 $null2 $ns at 0.0 "$cbr0 start" $ns at 5.0 "$cbr0 stop" $ns at 6 "finish" $ns run