【发布时间】:2020-07-19 10:29:18
【问题描述】:
我在 NS3 中有一个客户端/服务器拓扑,我想计算服务器上 UDP 流量的吞吐量。
这行代码sink = StaticCast<PacketSink> (tcpServerApp.Get (0));不起作用,因为它只能用于计算TCP数据包的吞吐量。如何计算服务器上接收到的 UDP 流量的吞吐量?
谢谢
【问题讨论】:
标签: udp throughput ns-3
我在 NS3 中有一个客户端/服务器拓扑,我想计算服务器上 UDP 流量的吞吐量。
这行代码sink = StaticCast<PacketSink> (tcpServerApp.Get (0));不起作用,因为它只能用于计算TCP数据包的吞吐量。如何计算服务器上接收到的 UDP 流量的吞吐量?
谢谢
【问题讨论】:
标签: udp throughput ns-3
您可以使用以下代码计算 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 错误。 可能是什么问题?
谢谢
【讨论】: