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.));
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
|
||||
|
||||
@@ -66,10 +68,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.));
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/pcap-trace.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
|
||||
|
||||
@@ -67,10 +69,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.));
|
||||
|
||||
@@ -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.));
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/pcap-trace.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("DumbbellSimulation");
|
||||
|
||||
@@ -124,19 +126,55 @@ main (int argc, char *argv[])
|
||||
//
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client0 = CreateObject<UdpEchoClient> (n0, "10.1.2.1",
|
||||
port, 100, Seconds(.01), 1024);
|
||||
Ptr<UdpEchoClient> client1 = CreateObject<UdpEchoClient> (n1, "10.1.2.2",
|
||||
port, 100, Seconds(.01), 1024);
|
||||
Ptr<UdpEchoClient> client2 = CreateObject<UdpEchoClient> (n2, "10.1.2.3",
|
||||
port, 100, Seconds(.01), 1024);
|
||||
Ptr<UdpEchoClient> client3 = CreateObject<UdpEchoClient> (n3, "10.1.2.4",
|
||||
port, 100, Seconds(.01), 1024);
|
||||
Ptr<UdpEchoClient> client0 =
|
||||
CreateObjectWith<UdpEchoClient> (
|
||||
"Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client0);
|
||||
Ptr<UdpEchoClient> client1 =
|
||||
CreateObjectWith<UdpEchoClient> (
|
||||
"Node", n1,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n1->AddApplication (client1);
|
||||
Ptr<UdpEchoClient> client2 =
|
||||
CreateObjectWith<UdpEchoClient> (
|
||||
"Node", n2,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.3"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n2->AddApplication (client2);
|
||||
Ptr<UdpEchoClient> client3 =
|
||||
CreateObjectWith<UdpEchoClient> (
|
||||
"Node", n3,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.4"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n3->AddApplication (client3);
|
||||
|
||||
Ptr<UdpEchoServer> server4 = CreateObject<UdpEchoServer> (n4, port);
|
||||
Ptr<UdpEchoServer> server5 = CreateObject<UdpEchoServer> (n5, port);
|
||||
Ptr<UdpEchoServer> server6 = CreateObject<UdpEchoServer> (n6, port);
|
||||
Ptr<UdpEchoServer> server7 = CreateObject<UdpEchoServer> (n7, port);
|
||||
Ptr<UdpEchoServer> server4 =
|
||||
CreateObjectWith<UdpEchoServer> ("Node", n4, "Port", Uinteger (port));
|
||||
n4->AddApplication (server4);
|
||||
Ptr<UdpEchoServer> server5 =
|
||||
CreateObjectWith<UdpEchoServer> ("Node", n5, "Port", Uinteger (port));
|
||||
n5->AddApplication (server5);
|
||||
Ptr<UdpEchoServer> server6 =
|
||||
CreateObjectWith<UdpEchoServer> ("Node", n6, "Port", Uinteger (port));
|
||||
n6->AddApplication (server6);
|
||||
Ptr<UdpEchoServer> server7 =
|
||||
CreateObjectWith<UdpEchoServer> ("Node", n7, "Port", Uinteger (port));
|
||||
n7->AddApplication (server7);
|
||||
|
||||
server4->Start(Seconds(1.));
|
||||
server5->Start(Seconds(1.));
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/pcap-trace.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("PointToPointSimulation");
|
||||
|
||||
@@ -58,10 +60,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.));
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/pcap-trace.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
#include "point-to-point-ipv4-topology.h"
|
||||
|
||||
@@ -145,10 +147,19 @@ main (int argc, char *argv[])
|
||||
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n4, "10.1.1.2",
|
||||
port, 1, Seconds(1.), 1024);
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObjectWith<UdpEchoClient> ("Node", n4,
|
||||
"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.));
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "ns3/ascii-trace.h"
|
||||
#include "ns3/pcap-trace.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
#include "point-to-point-ipv4-topology.h"
|
||||
|
||||
@@ -145,10 +147,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