1
1
h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/netanim-module.h"
NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
Time::SetResolution (Time::NS);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
NodeContainer nodes;
nodes.Create (3);
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
InternetStackHelper stack;
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ptr<Node> n0 = nodes.Get(0);
Ptr<Node> n1 = nodes.Get(1);
Ptr<Node> n2 = nodes.Get(2);
AnimationInterface anim("output/myfirst.xml");
anim.SetConstantPosition(n0, 100, 800);
anim.SetConstantPosition(n1, 400, 800);
anim.SetConstantPosition(n2, 800, 800);
Simulator::Run ();
Simulator::Destroy ();
return 0;
}