examples: Use different constructor for UdpTraceClientHelper in udp client-server example
This commit is contained in:
@@ -34,6 +34,7 @@ main(int argc, char* argv[])
|
||||
// Declare variables used in command-line arguments
|
||||
bool useV6 = false;
|
||||
bool logging = true;
|
||||
uint16_t port = 4000;
|
||||
Address serverAddress;
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
@@ -67,18 +68,17 @@ main(int argc, char* argv[])
|
||||
Ipv4AddressHelper ipv4;
|
||||
ipv4.SetBase("10.1.1.0", "255.255.255.0");
|
||||
Ipv4InterfaceContainer i = ipv4.Assign(d);
|
||||
serverAddress = Address(i.GetAddress(1));
|
||||
serverAddress = InetSocketAddress(i.GetAddress(1), port);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipv6AddressHelper ipv6;
|
||||
ipv6.SetBase("2001:0000:f00d:cafe::", Ipv6Prefix(64));
|
||||
Ipv6InterfaceContainer i6 = ipv6.Assign(d);
|
||||
serverAddress = Address(i6.GetAddress(1, 1));
|
||||
serverAddress = Inet6SocketAddress(i6.GetAddress(1, 1), port);
|
||||
}
|
||||
|
||||
NS_LOG_INFO("Create UdpServer application on node 1.");
|
||||
uint16_t port = 4000;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer apps = server.Install(n.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
@@ -86,7 +86,7 @@ main(int argc, char* argv[])
|
||||
|
||||
NS_LOG_INFO("Create UdpClient application on node 0 to send to node 1.");
|
||||
uint32_t MaxPacketSize = 1472; // Back off 20 (IP) + 8 (UDP) bytes from MTU
|
||||
UdpTraceClientHelper client(serverAddress, port, "");
|
||||
UdpTraceClientHelper client(serverAddress);
|
||||
client.SetAttribute("MaxPacketSize", UintegerValue(MaxPacketSize));
|
||||
apps = client.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
|
||||
Reference in New Issue
Block a user