how to install multiple on-off applications on one node

1,824 views
Skip to first unread message

posco

unread,
Jan 26, 2012, 12:00:37 PM1/26/12
to ns-3-users
Hi there,

I've been attempting to install multiple on-off application on one
node, but failed (I've searched trough this mailing list without luck
as well). Could somebody help me out?

Assuming there are 3 nodes A, B, C and two traffic flows originating
from A to B and C respectively. i.e.
A ----(on-off application)---->B;
A ----(on-off application)---->C;

But what I've got, from pcap packet traces, is only A-->B. It seems to
me that A-->C never got installed.
I'm using the following code in my simulation:

in main
...
Traffic t;
t.FlowPair(c,16,18, 9, 100,5,10);
t.FlowPair(c,16,20, 9, 100,5,10);
...

void Traffic::FlowPair(NodeContainer &c, int src, int dst, int port,
int rate, int start, int stop)
{

std::ostringstream oss;
oss<<rate<<"Mbps";

Ipv4InterfaceContainer server_host;
Ptr<Ipv4> ipv4node = c.Get(dst)->GetObject<Ipv4>();

OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (ipv4node->GetAddress(1,0).GetLocal(),
port));
onoff.SetAttribute ("DataRate", StringValue(oss.str()));
onoff.SetAttribute ("PacketSize",StringValue("10000") );

onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable
(1)));
onoff.SetAttribute ("OffTime", RandomVariableValue
(ConstantVariable (0)));


ApplicationContainer apps = onoff.Install (c.Get (src));
apps.Start (Seconds (start));
apps.Stop (Seconds (stop));


PacketSinkHelper sink ("ns3::UdpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), port));
apps = sink.Install (c.Get (dst));
apps.Start (Seconds (start));
apps.Stop (Seconds (stop));
}

Thanks in advance,
Posco

posco

unread,
Jan 26, 2012, 12:21:41 PM1/26/12
to ns-3-users
my apologies but more information.

after executing

Traffic t;
t.FlowPair(c,16,18,9,100,5,10);
t.FlowPair(c,16,20,9,100,5,10);

I can only see the traffic (node) 16--> (node)18. the line to install
on-off for (node) 16--> (node)20 has no effect.

please help. Thanks.

Posco

Ali Sydney

unread,
Jan 26, 2012, 12:46:36 PM1/26/12
to ns-3-...@googlegroups.com
Maybe the code from this NS3 script could help:


The code of interest starts from line 216

Cheers!
Syd

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


posco

unread,
Jan 26, 2012, 1:51:55 PM1/26/12
to ns-3-users
Hi Syd,

Thanks for your prompt response, I managed to figure out the problem.

My code is alright, but the problem was the data rate. In my
simulation the CSMA link has the capacity of 100Mbps, as in my example
case, I set both on-off applications to transmit at full speed, i.e.
100Mbps, so source node requires 200Mbps bandwidth. However, I
expected the two on-off applications would contend for bandwidth so
100Mb will get through and another 100Mb data will be dropped. It
turns out the NS-3 does not model application contending for bandwidth
so that primary installed on-off application ate up all bandwidth.

Cheers,
Posco

On Jan 26, 5:46 pm, Ali Sydney <asydney...@gmail.com> wrote:
> Maybe the code from this NS3 script could help:
>
> http://code.nsnam.org/ns-3-dev/file/ba6d0ca3e28a/examples/matrix-topo...
Reply all
Reply to author
Forward
0 new messages