examples: (fixes #2520) TCP variant not configured in wifi-tcp.cc
This commit is contained in:
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; /* Transport layer payload size in bytes. */
|
||||
std::string dataRate = "100Mbps"; /* Application layer datarate. */
|
||||
std::string tcpVariant = "ns3::TcpNewReno"; /* TCP variant type. */
|
||||
std::string tcpVariant = "TcpNewReno"; /* TCP variant type. */
|
||||
std::string phyRate = "HtMcs7"; /* Physical layer bitrate. */
|
||||
double simulationTime = 10; /* Simulation time in seconds. */
|
||||
bool pcapTracing = false; /* PCAP Tracing is enabled or not. */
|
||||
@@ -69,16 +69,35 @@ main (int argc, char *argv[])
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("payloadSize", "Payload size in bytes", payloadSize);
|
||||
cmd.AddValue ("dataRate", "Application data ate", dataRate);
|
||||
cmd.AddValue ("tcpVariant", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", tcpVariant);
|
||||
cmd.AddValue ("tcpVariant", "Transport protocol to use: TcpNewReno, "
|
||||
"TcpHybla, TcpHighSpeed, TcpHtcp, TcpVegas, TcpScalable, TcpVeno, "
|
||||
"TcpBic, TcpYeah, TcpIllinois, TcpWestwood, TcpWestwoodPlus, TcpLedbat ", tcpVariant);
|
||||
cmd.AddValue ("phyRate", "Physical layer bitrate", phyRate);
|
||||
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue ("pcap", "Enable/disable PCAP Tracing", pcapTracing);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
tcpVariant = std::string ("ns3::") + tcpVariant;
|
||||
|
||||
/* No fragmentation and no RTS/CTS */
|
||||
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("999999"));
|
||||
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("999999"));
|
||||
|
||||
// Select TCP variant
|
||||
if (tcpVariant.compare ("ns3::TcpWestwoodPlus") == 0)
|
||||
{
|
||||
// TcpWestwoodPlus is not an actual TypeId name; we need TcpWestwood here
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ()));
|
||||
// the default protocol type in ns3::TcpWestwood is WESTWOOD
|
||||
Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS));
|
||||
}
|
||||
else
|
||||
{
|
||||
TypeId tcpTid;
|
||||
NS_ABORT_MSG_UNLESS (TypeId::LookupByNameFailSafe (tcpVariant, &tcpTid), "TypeId " << tcpVariant << " not found");
|
||||
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TypeId::LookupByName (tcpVariant)));
|
||||
}
|
||||
|
||||
/* Configure TCP Options */
|
||||
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (payloadSize));
|
||||
|
||||
@@ -189,6 +208,6 @@ main (int argc, char *argv[])
|
||||
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
|
||||
exit (1);
|
||||
}
|
||||
std::cout << "\nAverage throughtput: " << averageThroughput << " Mbit/s" << std::endl;
|
||||
std::cout << "\nAverage throughput: " << averageThroughput << " Mbit/s" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user