equal
deleted
inserted
replaced
138 |
138 |
139 uint16_t multicastPort = 9; // Discard port (RFC 863) |
139 uint16_t multicastPort = 9; // Discard port (RFC 863) |
140 |
140 |
141 // Configure a multicast packet generator that generates a packet |
141 // Configure a multicast packet generator that generates a packet |
142 // every few seconds |
142 // every few seconds |
143 OnOffHelper onoff ("ns3::Udp", |
143 OnOffHelper onoff ("ns3::UdpSocketFactory", |
144 Address (InetSocketAddress (multicastGroup, multicastPort))); |
144 Address (InetSocketAddress (multicastGroup, multicastPort))); |
145 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
145 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
146 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
146 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
147 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s"))); |
147 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s"))); |
148 onoff.SetAttribute ("PacketSize", UintegerValue (128)); |
148 onoff.SetAttribute ("PacketSize", UintegerValue (128)); |
154 // |
154 // |
155 srcC.Start(Seconds(1.)); |
155 srcC.Start(Seconds(1.)); |
156 srcC.Stop (Seconds(10.)); |
156 srcC.Stop (Seconds(10.)); |
157 |
157 |
158 // Create an optional packet sink to receive these packets |
158 // Create an optional packet sink to receive these packets |
159 PacketSinkHelper sink ("ns3::Udp", |
159 PacketSinkHelper sink ("ns3::UdpSocketFactory", |
160 InetSocketAddress (Ipv4Address::GetAny(), multicastPort)); |
160 InetSocketAddress (Ipv4Address::GetAny(), multicastPort)); |
161 |
161 |
162 ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4 |
162 ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4 |
163 // Start the sink |
163 // Start the sink |
164 sinkC.Start (Seconds (1.0)); |
164 sinkC.Start (Seconds (1.0)); |