port Applications to Attributes

This commit is contained in:
Mathieu Lacage
2008-02-27 00:05:23 +01:00
parent 1ae525bf0e
commit e5e35f6545
35 changed files with 586 additions and 506 deletions

View File

@@ -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.));