samples/main-simple.cc
changeset 482 f844579404cb
parent 453 ddbb935800d8
child 501 612bd30cb669
equal deleted inserted replaced
481:508960b83d20 482:f844579404cb
     5 #include "ns3/udp.h"
     5 #include "ns3/udp.h"
     6 #include "ns3/socket.h"
     6 #include "ns3/socket.h"
     7 #include "ns3/nstime.h"
     7 #include "ns3/nstime.h"
     8 
     8 
     9 using namespace ns3;
     9 using namespace ns3;
    10 
       
    11 static void TestOne (void)
       
    12 {
       
    13   InternetNode *a = new InternetNode ();
       
    14 
       
    15   delete a;
       
    16 }
       
    17 
       
    18 static void TestTwo (void)
       
    19 {
       
    20   InternetNode a = InternetNode ();
       
    21 
       
    22   InternetNode *b = a.Copy ();
       
    23 
       
    24   delete b;
       
    25 }
       
    26 
       
    27 static void
       
    28 SmallTests (void)
       
    29 {
       
    30   TestOne ();
       
    31   TestTwo ();
       
    32 }
       
    33 
    10 
    34 static void
    11 static void
    35 GenerateTraffic (Socket *socket, uint32_t size)
    12 GenerateTraffic (Socket *socket, uint32_t size)
    36 {
    13 {
    37   std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
    14   std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
    54   socket->RecvDummy (MakeCallback (&SocketPrinter));
    31   socket->RecvDummy (MakeCallback (&SocketPrinter));
    55 }
    32 }
    56 
    33 
    57 int main (int argc, char *argv[])
    34 int main (int argc, char *argv[])
    58 {
    35 {
    59   SmallTests ();
       
    60 
       
    61   InternetNode *a = new InternetNode ();
    36   InternetNode *a = new InternetNode ();
    62 
    37 
    63   Socket *sink = a->GetUdp ()->CreateSocket ();
    38   Socket *sink = a->GetUdp ()->CreateSocket ();
    64   sink->Bind (80);
    39   sink->Bind (80);
    65 
    40