本文整理汇总了C++中Ptr::CheckForLostPackets方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::CheckForLostPackets方法的具体用法?C++ Ptr::CheckForLostPackets怎么用?C++ Ptr::CheckForLostPackets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ptr
的用法示例。
在下文中一共展示了Ptr::CheckForLostPackets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: part2
//.........这里部分代码省略.........
std::string sink_ = "/NodeList/5/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink_, MakeBoundCallback(&ReceivedPacket, stream1TP, oneFlowStart));
std::string sink = "/NodeList/5/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink, MakeBoundCallback(&ReceivedPacket, stream1GP, 0));
//TCP Tahoe from H2 to H5
cout << "Flow from H2 -> H5 : TcpTahoe" << endl;
cout << "Writing to app6_h2_h5_b.cwnd (congestion window) and app6_h2_h5_b.tp (throughput)" << endl;
Ptr<OutputStreamWrapper> stream2CWND = asciiTraceHelper.CreateFileStream("app6_h2_h5_b.cwnd");
Ptr<OutputStreamWrapper> stream2PD = asciiTraceHelper.CreateFileStream("app6_h2_h5_b.congestion_loss");
Ptr<OutputStreamWrapper> stream2TP = asciiTraceHelper.CreateFileStream("app6_h2_h5_b.tp");
Ptr<OutputStreamWrapper> stream2GP = asciiTraceHelper.CreateFileStream("app6_h2_h5_b.gp");
Ptr<Socket> ns3TcpSocket2 = uniFlow(InetSocketAddress(recieverIFCs.GetAddress(1), port), port, "TcpTahoe", senders.Get(1), recievers.Get(1), otherFlowStart, otherFlowStart+durationGap, packetSize, numPackets, transferSpeed, otherFlowStart, otherFlowStart+durationGap);
ns3TcpSocket2->TraceConnectWithoutContext("CongestionWindow", MakeBoundCallback (&CwndChange, stream2CWND, 0));
ns3TcpSocket2->TraceConnectWithoutContext("Drop", MakeBoundCallback (&packetDrop, stream2PD, 0, 2));
sink_ = "/NodeList/6/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink_, MakeBoundCallback(&ReceivedPacket, stream2TP, otherFlowStart));
sink = "/NodeList/6/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink, MakeBoundCallback(&ReceivedPacket, stream2GP, 0));
//TCP WestWood from H3 to H6
cout << "Flow from H3 -> H6 : TcpWestwood" << endl;
cout << "Writing to app6_h3_h6_b.cwnd (congestion window) and app6_h3_h6_b.tp (throughput)" << endl;
Ptr<OutputStreamWrapper> stream3CWND = asciiTraceHelper.CreateFileStream("app6_h3_h6_b.cwnd");
Ptr<OutputStreamWrapper> stream3PD = asciiTraceHelper.CreateFileStream("app6_h3_h6_b.congestion_loss");
Ptr<OutputStreamWrapper> stream3TP = asciiTraceHelper.CreateFileStream("app6_h3_h6_b.tp");
Ptr<OutputStreamWrapper> stream3GP = asciiTraceHelper.CreateFileStream("app6_h3_h6_b.gp");
Ptr<Socket> ns3TcpSocket3 = uniFlow(InetSocketAddress(recieverIFCs.GetAddress(2), port), port, "TcpWestwood", senders.Get(2), recievers.Get(2), otherFlowStart, otherFlowStart+durationGap, packetSize, numPackets, transferSpeed, otherFlowStart, otherFlowStart+durationGap);
ns3TcpSocket3->TraceConnectWithoutContext("CongestionWindow", MakeBoundCallback (&CwndChange, stream3CWND, 0));
ns3TcpSocket3->TraceConnectWithoutContext("Drop", MakeBoundCallback (&packetDrop, stream3PD, 0, 3));
sink = "/NodeList/7/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink, MakeBoundCallback(&ReceivedPacket, stream3GP, 0));
sink_ = "/NodeList/7/ApplicationList/0/$ns3::PacketSink/Rx";
Config::Connect(sink_, MakeBoundCallback(&ReceivedPacket, stream3TP, otherFlowStart));
//Turning on Static Global Routing
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
Ptr<FlowMonitor> flowmon;
FlowMonitorHelper flowmonHelper;
flowmon = flowmonHelper.InstallAll();
Simulator::Stop(Seconds(durationGap+otherFlowStart));
//animation("anim4.xml", routers, senders, recievers); //animation
Simulator::Run();
flowmon->CheckForLostPackets();
cout << "Part b throughput into app6_b.tp" << endl;
//Ptr<OutputStreamWrapper> streamTP = asciiTraceHelper.CreateFileStream("app6_b.tp");
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmonHelper.GetClassifier());
std::map<FlowId, FlowMonitor::FlowStats> stats = flowmon->GetFlowStats();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin(); i != stats.end(); ++i)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
if(t.sourceAddress == "10.1.0.1")
{
if(mapDrop.find(1)==mapDrop.end())
mapDrop[1] = 0;
*stream1PD->GetStream() << "TcpReno Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*stream1PD->GetStream() << "Net Packet Lost: " << i->second.lostPackets << "\n";
*stream1PD->GetStream() << "Packet Lost due to buffer overflow: " << mapDrop[1] << "\n";
*stream1PD->GetStream() << "Packet Lost due to Congestion: " << i->second.lostPackets - mapDrop[1] << "\n";
*stream1PD->GetStream() << "Max throughput: " << mapMaxThroughput["/NodeList/5/$ns3::Ipv4L3Protocol/Rx"] << std::endl;
}
else if(t.sourceAddress == "10.1.1.1")
{
if(mapDrop.find(2)==mapDrop.end())
mapDrop[2] = 0;
*stream2PD->GetStream() << "TcpTahoe Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*stream2PD->GetStream() << "Net Packet Lost: " << i->second.lostPackets << "\n";
*stream2PD->GetStream() << "Packet Lost due to buffer overflow: " << mapDrop[2] << "\n";
*stream2PD->GetStream() << "Packet Lost due to Congestion: " << i->second.lostPackets - mapDrop[2] << "\n";
*stream2PD->GetStream() << "Max throughput: " << mapMaxThroughput["/NodeList/6/$ns3::Ipv4L3Protocol/Rx"] << std::endl;
}
else if(t.sourceAddress == "10.1.2.1")
{
if(mapDrop.find(3)==mapDrop.end())
mapDrop[3] = 0;
*stream3PD->GetStream() << "TcpWestWood Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
*stream3PD->GetStream() << "Net Packet Lost: " << i->second.lostPackets << "\n";
*stream3PD->GetStream() << "Packet Lost due to buffer overflow: " << mapDrop[3] << "\n";
*stream3PD->GetStream() << "Packet Lost due to Congestion: " << i->second.lostPackets - mapDrop[3] << "\n";
*stream3PD->GetStream() << "Max throughput: " << mapMaxThroughput["/NodeList/7/$ns3::Ipv4L3Protocol/Rx"] << std::endl;
}
}
//flowmon->SerializeToXmlFile("app6_b.flowmon", true, true);
Simulator::Destroy();
}