110 // Create the OnOff application to send UDP datagrams of size |
110 // Create the OnOff application to send UDP datagrams of size |
111 // 210 bytes at a rate of 448 Kb/s |
111 // 210 bytes at a rate of 448 Kb/s |
112 uint16_t port = 9; // Discard port (RFC 863) |
112 uint16_t port = 9; // Discard port (RFC 863) |
113 OnOffHelper onoff ("ns3::UdpSocketFactory", |
113 OnOffHelper onoff ("ns3::UdpSocketFactory", |
114 Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); |
114 Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); |
115 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
115 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]")); |
116 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
116 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]")); |
117 onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); |
117 onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); |
118 ApplicationContainer apps = onoff.Install (nA); |
118 ApplicationContainer apps = onoff.Install (nA); |
119 apps.Start (Seconds (1.0)); |
119 apps.Start (Seconds (1.0)); |
120 apps.Stop (Seconds (10.0)); |
120 apps.Stop (Seconds (10.0)); |
121 |
121 |