32 #include "ns3/packet-sink.h" |
32 #include "ns3/packet-sink.h" |
33 #include "ns3/packet-socket-helper.h" |
33 #include "ns3/packet-socket-helper.h" |
34 #include "ns3/packet-socket-address.h" |
34 #include "ns3/packet-socket-address.h" |
35 #include "ns3/point-to-point-helper.h" |
35 #include "ns3/point-to-point-helper.h" |
36 #include "ns3/pointer.h" |
36 #include "ns3/pointer.h" |
37 #include "ns3/random-variable.h" |
|
38 #include "ns3/simulator.h" |
37 #include "ns3/simulator.h" |
39 #include "ns3/string.h" |
38 #include "ns3/string.h" |
40 #include "ns3/test.h" |
39 #include "ns3/test.h" |
41 #include "ns3/uinteger.h" |
40 #include "ns3/uinteger.h" |
42 |
41 |
134 // Create the OnOff application to send UDP datagrams of size |
133 // Create the OnOff application to send UDP datagrams of size |
135 // 210 bytes at a rate of 448 Kb/s |
134 // 210 bytes at a rate of 448 Kb/s |
136 uint16_t port = 9; // Discard port (RFC 863) |
135 uint16_t port = 9; // Discard port (RFC 863) |
137 OnOffHelper onoff ("ns3::UdpSocketFactory", |
136 OnOffHelper onoff ("ns3::UdpSocketFactory", |
138 Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); |
137 Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); |
139 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
138 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]")); |
140 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
139 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]")); |
141 onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); |
140 onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); |
142 ApplicationContainer apps = onoff.Install (nA); |
141 ApplicationContainer apps = onoff.Install (nA); |
143 apps.Start (Seconds (1.0)); |
142 apps.Start (Seconds (1.0)); |
144 apps.Stop (Seconds (10.0)); |
143 apps.Stop (Seconds (10.0)); |
145 |
144 |