port Applications to Attributes
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
#include "ipv4-bus-network.h"
|
||||
|
||||
@@ -41,11 +43,19 @@ main (int argc, char *argv[])
|
||||
uint32_t port = 7;
|
||||
|
||||
Ptr<Node> n0 = bus.GetNode (0);
|
||||
Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.0.1",
|
||||
port, 1, Seconds(1.), 1024);
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObjectWith<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.0.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<Node> n1 = bus.GetNode (1);
|
||||
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