port Applications to Attributes
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include "ns3/udp-echo-server.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
|
||||
|
||||
@@ -65,10 +67,19 @@ main (int argc, char *argv[])
|
||||
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2",
|
||||
port, 1, Seconds(1.), 1024);
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObjectWith<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObjectWith<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
client->Start(Seconds(2.));
|
||||
|
||||
Reference in New Issue
Block a user