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