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