Nodes able to connect via sockets, but no recv (help with ns3 + dce)

134 views
Skip to first unread message

Sorokine

unread,
Aug 22, 2015, 7:18:33 AM8/22/15
to ns-3-users
Hallo everyone and thanks in advance for reading this!
It's the first time I am posting here, I'll try to do my best to follow the rules of this group.

I am working on ubuntu, using ns3 with direct code executing. I'm new to ns3 and dce as well, but I read the guides and so far, I was able to fix every problem I encountered - but now I don't know where to start. I've got several nodes that run binaries of code, communicating with each other via TCP and sending stuff. This code I have tested previously, e.g. executed it in shells, and everything worked fine. Now I try to run them in my ns3-environment and they are able to connect via the ip-adresses and sockets I assigned to them - but after the first message is sent, nothing happens. As far as I can tell, the receiving node never gets the message, it just blocks on recv, and that's it. So far, my ns3 code seems to be quite trivial, but I have added it below.
My problem is that at this point, I don't know where to start searching for my problem. Outside of ns3, the code works just fine, inside ns3, the nodes are able to connect, but not to receive. What should I check, what could it be?
Thank you all very much in advance.

#include "ns3/network-module.h"
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/dce-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/netanim-module.h"
#include "ns3/constant-position-mobility-model.h"
#include "misc-tools.h"

using namespace ns3;

int main (int argc, char *argv[])
{
 
  NodeContainer nodes;
    nodes.Create(4);
  Ptr<Node> node1 = nodes.Get(0);
    Ptr<Node> node2 = nodes.Get(1);
    Ptr<Node> node3 = nodes.Get(2);
    Ptr<Node> node4 = nodes.Get(3);
 
DceManagerHelper dceManager;
InternetStackHelper stack;
stack.Install (nodes);

  PointToPointHelper pointToPoint;
  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
  pointToPoint.SetChannelAttribute ("Delay", StringValue ("1ms"));

  NetDeviceContainer devices;
  devices = pointToPoint.Install (node1, node2);
  Ipv4AddressHelper address;
  address.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer interfaces = address.Assign (devices);

  devices = pointToPoint.Install (node2, node3);
  address.SetBase ("10.1.2.0", "255.255.255.0");
  interfaces = address.Assign (devices);

  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
  dceManager.Install (nodes);
  DceApplicationHelper dce;

  ApplicationContainer apps;
  dce.SetStackSize (1 << 20);

  dce.SetBinary ("one");
  dce.ResetArguments ();
  dce.ResetEnvironment ();
  apps = dce.Install (node1);
  apps.Start (Seconds (1.0));
  apps.Stop (Seconds (40));

  dce.SetBinary ("two");
  dce.ResetArguments ();
  dce.ResetEnvironment ();
  apps = dce.Install (node2);
  apps.Start (Seconds (2.0));
  apps.Stop (Seconds (40));
 
  dce.SetBinary ("three");
  dce.ResetArguments ();
  dce.ResetEnvironment ();
  apps = dce.Install (node3);
  apps.Start (Seconds (3.0));
  apps.Stop (Seconds (40));

  setPos (nodes.Get (0), 1, 10, 0);
  setPos (nodes.Get (1), 50,10, 0);
  setPos (nodes.Get (2), 25,10, 0);
 
  Simulator::Stop (Seconds (50.0));
  Simulator::Run ();
  Simulator::Destroy ();

  return 0;
}


Sorokine

unread,
Aug 25, 2015, 8:27:40 AM8/25/15
to ns-3-users
The error was located elsewhere in the code. No help needed anymore. Sorry to bother you.

mateus....@gmail.com

unread,
Mar 26, 2016, 11:25:27 AM3/26/16
to ns-3-users, laura.war...@gmail.com
Hello Sorokine,
Can you please share what exactly was the error?
I have the same problem here.

Thank you
mateus
Reply all
Reply to author
Forward
0 new messages