0
votes

I have a client/server topology in NS3 and I want to calculate the throughput of UDP traffic on the server. This line of code sink = StaticCast<PacketSink> (tcpServerApp.Get (0)); does not work because it can only be used in calculating the throughput of TCP packets. How can I calculate throughput for the received UDP traffic on the server?

Thanks

2

2 Answers

0
votes

You can calculate the throughput of UDP packets using the following code. You should use this code after Simulation::Run();

      uint64_t rxBytes = 0;

      rxBytes = payloadSize * DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
      double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
      std::cout << "throughput = " << throughput << " Mbit/s" << std::endl;
0
votes

Thanks because of the answer. I implemented the code:

uint64_t rxBytes = 0;
  rxBytes = 1400 * DynamicCast<UdpServer> (ServerApp.Get (0))->GetReceived ();
  double throughput = (rxBytes * 8) / (10 * 1000000.0); //Mbit/s
  std::cout << "throughput = " << throughput << " Mbit/s" << std::end

But I got the SIGSEGV Error. What can be the problem?

Thanks