Install application on nodes

63 views
Skip to first unread message

adhysa...@gmail.com

unread,
Aug 4, 2017, 6:23:23 PM8/4/17
to ns-3-users
Hi,

I'm simulating a manet scenario with 25 nodes, plus one sink node, and two source nodes that send traffic to the sink node. Ideally, I want to have the flows:
Flow 1: Source(10.1.1.27) <--> Sink(10.1.1.28)
Flow 2: Source(10.1.1.26) <--> Sink(10.1.1.28)

So I created the node containers:
uint32_t numNodes = 28; // 25 nodes + 1 sink + 2 sources

NodeContainer c;
c
.Create (numNodes);
 
Ptr<Node> sinkNodes = c.Get(numNodes - 1);  
Ptr<Node> sourceNodes[2] = {c.Get(numNodes - 2),
                            c
.Get(numNodes - 3)};

And I'm installing the BulkSendApplication on the nodes:
Ipv4InterfaceContainer ic = ipv4.Assign (devices);

uint16_t port
= 9;  // well-known echo port number
 
for (int i = 0; i < 2; i++) {      
 
//
 
// Configuring Bulk Send Application and installing in the Source Nodes
 
//
 
BulkSendHelper source ("ns3::TcpSocketFactory",
                         
InetSocketAddress (ic.GetAddress ((numNodes - 2) - i), port)); 

 
// Set the amount of data to send in bytes.  Zero is unlimited.
  source
.SetAttribute ("SendSize", UintegerValue (1024));
  source
.SetAttribute ("MaxBytes", UintegerValue (5120000)); // 5 MB

 
ApplicationContainer sourceApps = source.Install (sourceNodes[i]);
  sourceApps
.Start (Seconds (30.0));
  sourceApps
.Stop (Seconds (4000.0));
 
 
//
 
// Create a packet sink Application and install it on the Sink nodes
 
//
 
PacketSinkHelper sink ("ns3::TcpSocketFactory",
  
InetSocketAddress (ic.GetAddress (numNodes - 1), port));
  
//InetSocketAddress (Ipv4Address::GetAny (), port));

 
ApplicationContainer sinkApps = sink.Install (sinkNodes);
  sinkApps
.Start (Seconds (0.0));
  sinkApps
.Stop (Seconds (4000.0));

  std::cout << "Flow "<< i + 1 << ": Source(" << ic.GetAddress ((numNodes - 2) - i) << ") <--> Sink(" << ic.GetAddress (numNodes - 1) << ")" << std::endl;
}

The about print shows (I know, just a print)
Flow 1: Source(10.1.1.27) <--> Sink(10.1.1.28)
Flow 2: Source(10.1.1.26) <--> Sink(10.1.1.28)

The problem is when I open FlowMonitor to check the flows, I get the following flows:
<Ipv4FlowClassifier>
   
<Flow flowId="2" sourceAddress="10.1.1.26" destinationAddress="10.1.1.26" protocol="6" sourcePort="9" destinationPort="49153" />
   
<Flow flowId="1" sourceAddress="10.1.1.26" destinationAddress="10.1.1.26" protocol="6" sourcePort="49153" destinationPort="9" />
   
<Flow flowId="4" sourceAddress="10.1.1.27" destinationAddress="10.1.1.27" protocol="6" sourcePort="9" destinationPort="49153" />
   
<Flow flowId="3" sourceAddress="10.1.1.27" destinationAddress="10.1.1.27" protocol="6" sourcePort="49153" destinationPort="9" />
 
</Ipv4FlowClassifier>

To this point I couldn't figure out the error. Can you help please?

Thank you

Konstantinos

unread,
Aug 5, 2017, 9:02:19 AM8/5/17
to ns-3-users
Hi,

Few comments.

The results are as expected:
- First you should see 4 flows, that's because you use TCP. For each connection, you have the data and ack flow (reverse).
- Now for the source/dst pairs. That's wrong configuration of your Bulk application. Particularly:

  BulkSendHelper source ("ns3::TcpSocketFactory",
                         
InetSocketAddress (ic.GetAddress ((numNodes - 2) - i), port));

here you need to put the address of the destination node, not the source.
The source address will be automatically be configures once you install the application on the node with this 

ApplicationContainer sourceApps = source.Install (sourceNodes[i]);

Regards
K
Reply all
Reply to author
Forward
0 new messages