3 #include "ns3/core-module.h"
4 #include "ns3/network-module.h"
5 #include "ns3/internet-module.h"
13 socket->
Send (Create<Packet> (size));
28 while ((packet = socket->
Recv ()))
68 int main (
int argc,
char *argv[])
static Ipv4Address GetAny(void)
static void Run(void)
Run the simulation until one of:
aggregate IP/TCP/UDP functionality to existing Nodes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
int main(int argc, char *argv[])
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static void GenerateTraffic(Ptr< Socket > socket, uint32_t size)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
static Time Now(void)
Return the "current simulation time".
static Ipv4Address GetLoopback(void)
static void PrintTraffic(Ptr< Socket > socket)
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static void SocketPrinter(Ptr< Socket > socket)
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)