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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", hubLocalAddress); | 104 PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", hubLocalAddress); |
105 ApplicationContainer hubApp = packetSinkHelper.Install (star.GetHub ()); | 105 ApplicationContainer hubApp = packetSinkHelper.Install (star.GetHub ()); |
106 hubApp.Start (Seconds (1.0)); | 106 hubApp.Start (Seconds (1.0)); |
107 hubApp.Stop (Seconds (10.0)); | 107 hubApp.Stop (Seconds (10.0)); |
108 | 108 |
109 // | 109 // |
110 // Create OnOff applications to send TCP to the hub, one on each spoke node. | 110 // Create OnOff applications to send TCP to the hub, one on each spoke node. |
111 // | 111 // |
112 OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ()); | 112 OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ()); |
113 onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))
); | 113 onOffHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[
Constant=1]")); |
114 onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)
)); | 114 onOffHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable
[Constant=0]")); |
115 | 115 |
116 ApplicationContainer spokeApps; | 116 ApplicationContainer spokeApps; |
117 | 117 |
118 for (uint32_t i = 0; i < star.SpokeCount (); ++i) | 118 for (uint32_t i = 0; i < star.SpokeCount (); ++i) |
119 { | 119 { |
120 AddressValue remoteAddress; | 120 AddressValue remoteAddress; |
121 if (useIpv6 == 0) | 121 if (useIpv6 == 0) |
122 { | 122 { |
123 remoteAddress = AddressValue(InetSocketAddress (star.GetHubIpv4Address
(i), port)); | 123 remoteAddress = AddressValue(InetSocketAddress (star.GetHubIpv4Address
(i), port)); |
124 } | 124 } |
(...skipping 22 matching lines...) Expand all Loading... |
147 // Create the animation object and configure for specified output | 147 // Create the animation object and configure for specified output |
148 AnimationInterface anim (animFile); | 148 AnimationInterface anim (animFile); |
149 | 149 |
150 NS_LOG_INFO ("Run Simulation."); | 150 NS_LOG_INFO ("Run Simulation."); |
151 Simulator::Run (); | 151 Simulator::Run (); |
152 Simulator::Destroy (); | 152 Simulator::Destroy (); |
153 NS_LOG_INFO ("Done."); | 153 NS_LOG_INFO ("Done."); |
154 | 154 |
155 return 0; | 155 return 0; |
156 } | 156 } |
OLD | NEW |