Issue with instantiating echo server on wifi STA node

82 views
Skip to first unread message

Omri Levia

unread,
Feb 5, 2020, 2:33:11 PM2/5/20
to ns-3-users
Hello all,

I am new to ns-3 and have followed the ns-3 tutorial through chapter 6. I am trying to tweak the example simulation called mythird.cc.

The topology is as follows:

//   Wifi 10.1.3.0
//                 AP
//  *    *    *    *
//  |    |    |    |    10.1.1.0
// n5   n6   n7   n0 -------------- n1   n2   n3   n4
//                   point-to-point       |     |        |    |
//                                           ================
//                                              LAN 10.1.2.0

The tutorial sets up an echo server on the last csma node (n4), and places the echo client on one of the wifi nodes.

I am trying to reverse this setup with the server instead on one of the wifi nodes, and the client on one of the csma nodes, like so:

 UdpEchoServerHelper echoServer (9);
 
  // Install the server on the second to last wifi node
  ApplicationContainer serverApps = echoServer.Install (wifiStaNodes.Get(nWifi-1));
  serverApps.Start (Seconds (1.0));
  serverApps.Stop (Seconds (10.0));
  // Direct the client to the server's address
  UdpEchoClientHelper echoClient (staDevices.Get(nWifi-1)->GetAddress(), 9);
  echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
  echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
  echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
  // Install the client on the last csma node
  ApplicationContainer clientApps =
    echoClient.Install (csmaNodes.Get(nCsma));
  clientApps.Start (Seconds (2.0));
  clientApps.Stop (Seconds (10.0));

When I run the simulation I receive an error with message "incompatible address type."

What should I be doing differently?
Thank you for your responses,

Omri

Omri Levia

unread,
Feb 5, 2020, 3:42:40 PM2/5/20
to ns-3-users
I just resolved the issue by creating a staInterface for my staDevices, and directing the echo client to staInterface.GetAddress(nWifi-1).

Now the simulation runs without error.
Reply all
Reply to author
Forward
0 new messages