From 69dfbe8707e93c055b14fc79811aed5602511539 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 24 Mar 2008 16:30:37 -0700 Subject: [PATCH] port to helper API. --- samples/main-simple.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/samples/main-simple.cc b/samples/main-simple.cc index a2c6ec501..7763d6b8b 100644 --- a/samples/main-simple.cc +++ b/samples/main-simple.cc @@ -1,12 +1,9 @@ #include -#include "ns3/internet-node.h" -#include "ns3/simulator.h" -#include "ns3/socket-factory.h" -#include "ns3/socket.h" -#include "ns3/inet-socket-address.h" -#include "ns3/nstime.h" -#include "ns3/packet.h" +#include "ns3/core-module.h" +#include "ns3/helper-module.h" +#include "ns3/node-module.h" +#include "ns3/simulator-module.h" using namespace ns3; @@ -40,10 +37,15 @@ PrintTraffic (Ptr socket) void RunSimulation (void) { - Ptr a = CreateObject (); + NodeContainer c; + c.Create (1); + + InternetStackHelper internet; + internet.Build (c); + TypeId tid = TypeId::LookupByName ("ns3::Udp"); - Ptr socketFactory = a->GetObject (tid); + Ptr socketFactory = c.Get (0)->GetObject (tid); Ptr sink = socketFactory->CreateSocket (); InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);