OnOff traffic single port multiple client

418 views
Skip to first unread message

Abdul Sikandar

unread,
Apr 9, 2015, 6:23:18 AM4/9/15
to ns-3-...@googlegroups.com
I want to install OnOff Application on a node which can send CBR traffic over TCP to multiple sink. My scenario is:
Consider A,B,C nodes and two flows A -> B, A -> C. I want that traffic for both flow should be served by node 'A' on single port. Currrently node 'A' uses two different port for node 'B' and 'C'.
A:49153 -> B:8899
B:49154 -> B:8899
Here is part of Application code :

PacketSinkHelper sink ("ns3::TcpSocketFactory",InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
  ApplicationContainer sinkApp = sink.Install (staNodes);
  sinkApp.Start (Seconds (1.0));
  sinkApp.Stop (Seconds (20.0));
 
  //Applications
  OnOffHelper sourceHelper ("ns3::TcpSocketFactory",Address());
  sourceHelper.SetConstantRate (ns3::DataRate("120kb/s"), uint32_t(1024));

 
  ApplicationContainer sourceApp;
  for(uint32_t i=0; i<staNodes.GetN (); ++i)
  {
        AddressValue remoteAddress (InetSocketAddress (staInterface.GetAddress (i), sinkPort));
        sourceHelper.SetAttribute ("Remote", remoteAddress);
        sourceApp.Add (sourceHelper.Install (serverNode));
        sourceApp.Start (Seconds (1.5+i));
  }
  sourceApp.Stop (Seconds (20.0));
plz reply is there anyway to do so in ns3.

Tommaso Pecorella

unread,
Apr 9, 2015, 9:20:16 AM4/9/15
to ns-3-...@googlegroups.com
Hi,

if you don't change the "sinkPort" variable, then your code already does what you're saying.

T.
Message has been deleted

Abdul Sikandar

unread,
Apr 9, 2015, 12:08:13 PM4/9/15
to ns-3-...@googlegroups.com
Thanx for your reply, sorry their is a typo. I want to send tcp traffic to multiple nodes from single OnOff Application. Code submitted above creates separate instances for evry client. I want node 'A' to act as server and send OnOff traffic to any connected client

Konstantinos

unread,
Apr 9, 2015, 12:25:06 PM4/9/15
to ns-3-...@googlegroups.com
With the current implementation of the OnOffApplication you can not achieve this.
You need to modify it, or develop your own application, which will create multiple connections. 

K.

Abdul Sikandar

unread,
Apr 9, 2015, 1:24:25 PM4/9/15
to ns-3-...@googlegroups.com
It would be really heelpful, if you could point me to some implementation of tcp server in ns3 to begin with.

Tommaso Pecorella

unread,
Apr 9, 2015, 2:52:12 PM4/9/15
to ns-3-...@googlegroups.com
Hi,

please... the application that opens the connection is a CLIENT.

What do you use to browse the Internet (i.e., your Internet Browser), a server or a client ?
A client.
And who's starting the connection, the browser or the Web Server ?
The browser.
And why the Web Server is named a Server ?
Because it's a server, it's waiting there for a TCP connection.

The clients usually use random ports, and that's what OnOffApplication is doing.

About an example... you have OnOffApplication, what's wrong with it ? It's a perfect example (of a client).
About a server (a real one), PacketSink is a server. Again, it's a good example.

Have fun,

T.
Reply all
Reply to author
Forward
0 new messages