Antonio Grilo
unread,Nov 11, 2010, 1:24:03 PM11/11/10Sign 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
Dear all,
I'm trying to run the aodv.cc and olsr-hna.cc examples. The PCAP
output shows that for both, the routing messages are received.
However, no data packet is ever transmitted to the air.
Besides, I've built and example based on my own transport protocol
DTSN (which was already tested successfully with CSMA) in a linear
topology with 3 nodes. I've tried both AODV and OLSR. When I put the
client and server together, everything works fine. When I try to put
them apart with a third node in the middle, strange things happen:
- Routing messages from each node are received by all other nodes
according to the PCAP output.
- However, in AODV, only Route Reply messages are seen. Where are the
respective Route Requests?
- No data packet is ever transmitted to the air according to the PCAP
output.
I went more deeply into this and switched on the Wifi logging.
According to the messages, the wifi device of the client de-queues the
packet and tries to send it to the air (where is it?). The packet is
received by the server (NotifyRxEndOkNow()!!!). But no ACK is ever
sent. Then the sender retries and so on. As I told you, the data
packets do not appear in the PCAP output.
Is anyone else experiencing similar problems?
My example follows:
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/helper-module.h"
#include "ns3/common-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("DtsnClientServerExample");
int
main (int argc, char *argv[])
{
//
// Enable logging for DtsnClient and
//
LogComponentEnable ("DtsnClient", LOG_LEVEL_INFO);
LogComponentEnable ("DtsnServer", LOG_LEVEL_INFO);
//
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (3);
NS_LOG_INFO ("Create channels.");
//
// Explicitly create the channels required by the topology.
//
WifiHelper wifi = WifiHelper::Default ();
wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default
();
wifiMac.SetType ("ns3::AdhocWifiMac");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue
("OfdmRate48Mbps"));
wifiPhy.SetChannel (wifiChannel.Create ());
// Tracing
NetDeviceContainer d = wifi.Install (wifiPhy, wifiMac, n);
wifiPhy.EnablePcap ("dtsn-client-server", d);
//
// Create Internet stack.
//
InternetStackHelper internet;
AodvHelper routing;
internet.SetRoutingHelper (routing);
// OlsrHelper routing;
// internet.SetRoutingHelper (routing);
internet.Install (n);
//
// We've got the "hardware" in place. Now we need to add IP
addresses.
//
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (d);
//
// Explicitly assign node positions.
//
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc =
CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (20.0, 0.0, 0.0));
positionAlloc->Add (Vector (40.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (n);
// CsmaHelper csma;
// csma.SetChannelAttribute ("DataRate", DataRateValue
(DataRate(5000000)));
// csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
// csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
// NetDeviceContainer d = csma.Install (n);
NS_LOG_INFO ("Set DTSN socket attributes.");
Config::SetDefault ("ns3::DtsnSocketImpl::AWSize", UintegerValue
(5));
Config::SetDefault ("ns3::DtsnSocketImpl::AWNumber", UintegerValue
(3));
NS_LOG_INFO ("Create Applications.");
//
// Create one dtsnServer applications on node one.
//
uint16_t port = 4000;
DtsnServerHelper server (port);
ApplicationContainer apps = server.Install (n.Get(2));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
//
// Create one DtsnClient application to send DTSN datagrams from node
zero to
// node one.
//
uint32_t MaxPacketSize = 1024;
Time interPacketInterval = Seconds (0.05);
uint32_t maxPacketCount = 320;
DtsnClientHelper client (i.GetAddress (2), port);
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
apps = client.Install (n.Get (0));
apps.Start (Seconds (10.0));
apps.Stop (Seconds (20.0));
//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}