NS3中的UDP吞吐量计算

我在NS3中具有客户端/服务器拓扑,我想计算服务器上UDP流量的吞吐量。 这行代码sink = StaticCast<PacketSink> (tcpServerApp.Get (0));不起作用,因为它只能用于计算TCP数据包的吞吐量。如何计算服务器上收到的UDP流量的吞吐量?

谢谢

sxlyya 回答:NS3中的UDP吞吐量计算

您可以使用以下代码来计算UDP数据包的吞吐量。您应该在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;
,

感谢您的回答。 我实现了代码:

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

但是我收到了SIGSEGV错误。 可能是什么问题?

谢谢

本文链接:https://www.f2er.com/2495410.html

大家都在问