Wireless Ad hoc with TCP over OLSR

101 views
Skip to first unread message

John Scott

unread,
Apr 26, 2017, 5:49:55 PM4/26/17
to ns-3-users
Hi Folks,

I wrote a script to simulate a wireless ad hoc network that uses OLSR as routing protocol and TCP BulkSend application. I am testing my scenario with 10 nodes, including one sink and one source nodes in a 500 x 500 m area (i place the nodes very close to make sure that their are in line of sight).

The thing is there is no TCP packets being transmitted at all. I looked at other examples in the mailing list but they look similar to mine. Here's a snippet of my code (full script attached).

  // Enable OLSR
 
OlsrHelper olsr;
 
Ipv4StaticRoutingHelper staticRouting;

 
Ipv4ListRoutingHelper list;
  list
.Add (staticRouting, 0);
  list
.Add (olsr, 10);

 
InternetStackHelper internet;
  internet
.SetRoutingHelper (list); // has effect on the next Install ()
  internet
.Install (c);

 
Ipv4AddressHelper ipv4;
  NS_LOG_INFO
("Assign IP Addresses.");
  ipv4
.SetBase ("10.1.1.0", "255.255.255.0");
 
Ipv4InterfaceContainer i = ipv4.Assign (devices);
 
  uint16_t port
= 9;  // well-known echo port number

 
// Configuring Bulk Send Application and installing in the Source Node
 
BulkSendHelper source ("ns3::TcpSocketFactory",
                         
InetSocketAddress (Ipv4Address::GetAny (), 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 (c.Get (sourceNode));
  sourceApps
.Start (Seconds (30.0)); // to give time to OLSR to converge
  sourceApps
.Stop (Seconds (4000.0));
 
 
// Create a packet sink Application and install it on the Sink node
 
PacketSinkHelper sink ("ns3::TcpSocketFactory",
                         
InetSocketAddress (Ipv4Address::GetAny (), port));
                         
 
ApplicationContainer sinkApps = sink.Install (c.Get (sinkNode));
  sinkApps
.Start (Seconds (0.0));
  sinkApps
.Stop (Seconds (4000.0));
 
 
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1460));

What am I missing?


Thank you
wifi-olsr-tcp.cc

John Scott

unread,
Apr 26, 2017, 6:11:51 PM4/26/17
to ns-3-users
Got it!

The source node should be:
BulkSendHelper source ("ns3::TcpSocketFactory",

                         
InetSocketAddress (i.GetAddress (sinkNode), port));


Thanks anyway :)
Reply all
Reply to author
Forward
0 new messages