OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // multicast group (node four will be listening). | 127 // multicast group (node four will be listening). |
128 // | 128 // |
129 NS_LOG_INFO ("Create Applications."); | 129 NS_LOG_INFO ("Create Applications."); |
130 | 130 |
131 uint16_t multicastPort = 9; // Discard port (RFC 863) | 131 uint16_t multicastPort = 9; // Discard port (RFC 863) |
132 | 132 |
133 // Configure a multicast packet generator that generates a packet | 133 // Configure a multicast packet generator that generates a packet |
134 // every few seconds | 134 // every few seconds |
135 OnOffHelper onoff ("ns3::UdpSocketFactory",· | 135 OnOffHelper onoff ("ns3::UdpSocketFactory",· |
136 Address (InetSocketAddress (multicastGroup, multicastPort))
); | 136 Address (InetSocketAddress (multicastGroup, multicastPort))
); |
137 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); | 137 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Consta
nt=1]")); |
138 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); | 138 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Const
ant=0]")); |
139 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s"))); | 139 onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s"))); |
140 onoff.SetAttribute ("PacketSize", UintegerValue (128)); | 140 onoff.SetAttribute ("PacketSize", UintegerValue (128)); |
141 | 141 |
142 ApplicationContainer srcC = onoff.Install (c0.Get (0)); | 142 ApplicationContainer srcC = onoff.Install (c0.Get (0)); |
143 | 143 |
144 // | 144 // |
145 // Tell the application when to start and stop. | 145 // Tell the application when to start and stop. |
146 // | 146 // |
147 srcC.Start (Seconds (1.)); | 147 srcC.Start (Seconds (1.)); |
148 srcC.Stop (Seconds (10.)); | 148 srcC.Stop (Seconds (10.)); |
(...skipping 23 matching lines...) Expand all Loading... |
172 csma.EnablePcapAll ("csma-multicast", false); | 172 csma.EnablePcapAll ("csma-multicast", false); |
173 | 173 |
174 // | 174 // |
175 // Now, do the actual simulation. | 175 // Now, do the actual simulation. |
176 // | 176 // |
177 NS_LOG_INFO ("Run Simulation."); | 177 NS_LOG_INFO ("Run Simulation."); |
178 Simulator::Run (); | 178 Simulator::Run (); |
179 Simulator::Destroy (); | 179 Simulator::Destroy (); |
180 NS_LOG_INFO ("Done."); | 180 NS_LOG_INFO ("Done."); |
181 } | 181 } |
OLD | NEW |