port to helper API.
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
#include <iostream>
|
||||
|
||||
#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> socket)
|
||||
void
|
||||
RunSimulation (void)
|
||||
{
|
||||
Ptr<Node> a = CreateObject<InternetNode> ();
|
||||
NodeContainer c;
|
||||
c.Create (1);
|
||||
|
||||
InternetStackHelper internet;
|
||||
internet.Build (c);
|
||||
|
||||
|
||||
TypeId tid = TypeId::LookupByName ("ns3::Udp");
|
||||
Ptr<SocketFactory> socketFactory = a->GetObject<SocketFactory> (tid);
|
||||
Ptr<SocketFactory> socketFactory = c.Get (0)->GetObject<SocketFactory> (tid);
|
||||
|
||||
Ptr<Socket> sink = socketFactory->CreateSocket ();
|
||||
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
|
||||
|
||||
Reference in New Issue
Block a user