UDP Throughput Calculation in NS3

孤人 提交于 2021-01-29 06:02:03

问题


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


回答1:


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;



回答2:


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



来源:https://stackoverflow.com/questions/61076500/udp-throughput-calculation-in-ns3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!