examples/csma-packet-socket.cc
changeset 3026 4ef834f6b67d
parent 2965 4b28e9740e3b
child 3257 ba198dad54a2
equal deleted inserted replaced
3015:94d9153aee09 3026:4ef834f6b67d
    35 
    35 
    36 #include "ns3/core-module.h"
    36 #include "ns3/core-module.h"
    37 #include "ns3/simulator-module.h"
    37 #include "ns3/simulator-module.h"
    38 #include "ns3/node-module.h"
    38 #include "ns3/node-module.h"
    39 #include "ns3/helper-module.h"
    39 #include "ns3/helper-module.h"
    40 
       
    41 #include "ns3/ascii-trace.h"
       
    42 #include "ns3/pcap-trace.h"
       
    43 
    40 
    44 using namespace ns3;
    41 using namespace ns3;
    45 
    42 
    46 NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample");
    43 NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample");
    47 
    44 
   103   apps.Stop (Seconds (10.0));
   100   apps.Stop (Seconds (10.0));
   104  
   101  
   105   // Configure tracing of all enqueue, dequeue, and NetDevice receive events
   102   // Configure tracing of all enqueue, dequeue, and NetDevice receive events
   106   // Trace output will be sent to the csma-packet-socket.tr file
   103   // Trace output will be sent to the csma-packet-socket.tr file
   107   NS_LOG_INFO ("Configure Tracing.");
   104   NS_LOG_INFO ("Configure Tracing.");
   108   AsciiTrace asciitrace ("csma-packet-socket.tr");
   105   std::ofstream os;
   109   asciitrace.TraceAllNetDeviceRx ();
   106   os.open ("csma-packet-socket.tr");
   110   asciitrace.TraceAllQueues ();
   107   csma.EnableAsciiAll (os);
   111 
   108 
   112   NS_LOG_INFO ("Run Simulation.");
   109   NS_LOG_INFO ("Run Simulation.");
   113   Simulator::Run ();
   110   Simulator::Run ();
   114   Simulator::Destroy ();
   111   Simulator::Destroy ();
   115   NS_LOG_INFO ("Done.");
   112   NS_LOG_INFO ("Done.");