[ns] How to simulate one-hop broadcast scenario?
aavvee2002 at yahoo.com
Thu Oct 16 10:11:43 PDT 2008
Dear ns2 experts:
I'm simulating a scenario of a sender and multiple receives. Suppose node A is the sender, and there are two receivers: B and C.
I set 2 links: node A - node B, node A - node C.
And node A multicast packets to both node B and C.
With the following setting, from the .tr file, only node C get the packets. What's wrong for the tcl configuration? Thanks
set LinkDelay 5ms
$ns duplex-link $nodeA $nodeB 10Mb $LinkDelay DropTail
$ns duplex-link $nodeA $nodeC 10Mb $LinkDelay DropTail
set user_src(1) [new Agent/UDP]
set user_snk(2) [new Agent/Null]
set user_snk(3) [new Agent/Null]
$ns attach-agent $nodeA $user_src(1)
$ns attach-agent $nodeB $user_snk(2)
$ns attach-agent $nodeC $user_snk(3)
$ns connect $user_src(1) $user_snk(2)
$ns connect $user_src(1) $user_snk(3)
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $user_src(1)
$cbr set rate_ 1Mb
$ns at 10 "$cbr start"
$ns at 50 "$cbr stop"
More information about the Ns-users