posco
unread,Jan 26, 2012, 12:00:37 PM1/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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