[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] RTP in NS: how to setup several independant sessions




Hi,

I want to run some simple simulations of RTP. I'm having some problems. I
want to set up this topology:

	0
	|
	|
 2------1------4
	|
	|
	3

And set up independent RTP sessions between (0,2) and between (3,4). I
want node 1 to be a router that routes only at the IP layer. I
can't get this to work (eventually I want to move to much larger numbers
of independent sessions).

My questions (I hope they are not too simple):

1. Is it possible to set up RTP sessions without turning on multicast? I
tried this but got this error:  
error: can't transmit before joining group!

2. I tried making a separate group for each session, but the simulation
doesn't act right. In the script below I start nodes 0 and 2 at time 1.4,
and nodes 3 and 4 at time 2.4. However, at time 1.6, node 3 begins a
session with node 0. Since both nodes are in different groups, I don't
think they should be communicating.

My tcl script is below (it is very similar to sample-rtp.tcl. Any help
would be appreciated very much.

Thanks,
Matt

**********************


set ns [new Simulator -multicast on]

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

$ns color 1 red
# prune/graft packets
$ns color 30 purple
$ns color 31 bisque
# RTCP reports
$ns color 32 green

set f [open rtp-out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf

$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n2 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n3 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n4 1.5Mb 10ms DropTail

$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n0 $n1 queuePos 0.5

set mproto DM
set mrthandle [$ns mrtproto $mproto {}]
set group1 [Node allocaddr]
set group2 [Node allocaddr]

set s0 [new Session/RTP]
set s2 [new Session/RTP]
set s3 [new Session/RTP]
set s4 [new Session/RTP]

$s0 session_bw 400kb/s
$s2 session_bw 400kb/s
$s3 session_bw 400kb/s
$s4 session_bw 400kb/s

$s0 attach-node $n0
$s2 attach-node $n2
$s3 attach-node $n3
$s4 attach-node $n4

$ns at 1.4 "$s0 join-group $group1"
$ns at 1.5 "$s0 start"
$ns at 1.6 "$s0 transmit 400kb/s"

$ns at 2.4 "$s2 join-group $group1"
$ns at 2.5 "$s2 start"
$ns at 2.6 "$s2 transmit 400kb/s"

$ns at 1.4 "$s3 join-group $group2"
$ns at 1.5 "$s3 start"
$ns at 1.6 "$s3 transmit 400kb/s"

$ns at 2.4 "$s4 join-group $group2"
$ns at 2.5 "$s4 start"
$ns at 2.6 "$s4 transmit 400kb/s"

$ns at 4.0 "finish"

proc finish {} {
        global ns f nf
        $ns flush-trace
        close $f
        close $nf

        puts "running nam..."
        exec nam out.nam &
        exit 0
}

$ns run