|
102 |
app = onoff.Install(ns3.NodeContainer(terminals.Get(0))) |
102 |
app = onoff.Install(ns3.NodeContainer(terminals.Get(0))) |
103 |
# Start the application |
103 |
# Start the application |
104 |
app.Start(ns3.Seconds(1.0)) |
104 |
app.Start(ns3.Seconds(1.0)) |
105 |
app.Stop(ns3.Seconds(10.0)) |
105 |
#app.Stop(ns3.Seconds(10.0)) |
106 |
|
106 |
|
107 |
# Create an optional packet sink to receive these packets |
107 |
# Create an optional packet sink to receive these packets |
108 |
sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory", |
108 |
sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory", |
|
117 |
ns3.AddressValue(ns3.InetSocketAddress(ns3.Ipv4Address("10.1.1.1"), port))) |
117 |
ns3.AddressValue(ns3.InetSocketAddress(ns3.Ipv4Address("10.1.1.1"), port))) |
118 |
app = onoff.Install(ns3.NodeContainer(terminals.Get(3))) |
118 |
app = onoff.Install(ns3.NodeContainer(terminals.Get(3))) |
119 |
app.Start(ns3.Seconds(1.1)) |
119 |
app.Start(ns3.Seconds(1.1)) |
120 |
app.Stop(ns3.Seconds(10.0)) |
120 |
#app.Stop(ns3.Seconds(10.0)) |
121 |
|
121 |
|
122 |
app = sink.Install(ns3.NodeContainer(terminals.Get(0))) |
122 |
app = sink.Install(ns3.NodeContainer(terminals.Get(0))) |
123 |
app.Start (ns3.Seconds (0.0)) |
123 |
app.Start (ns3.Seconds (0.0)) |
|
138 |
# and can be read by the "tcpdump -r" command(use "-tt" option to |
138 |
# and can be read by the "tcpdump -r" command(use "-tt" option to |
139 |
# display timestamps correctly) |
139 |
# display timestamps correctly) |
140 |
# |
140 |
# |
141 |
ns3.CsmaHelper.EnablePcapAll("csma-bridge") |
141 |
#ns3.CsmaHelper.EnablePcapAll("csma-bridge") |
142 |
|
142 |
|
143 |
# |
143 |
# |
144 |
# Now, do the actual simulation. |
144 |
# Now, do the actual simulation. |
145 |
# |
145 |
# |
146 |
#print "Run Simulation." |
146 |
#print "Run Simulation." |
147 |
ns3.Simulator.Run() |
147 |
#import threading |
|
|
148 |
ns3.Simulator.Stop(ns3.Seconds(100)) |
149 |
ns3.Simulator.Run(signal_check_frequency=100) |
148 |
ns3.Simulator.Destroy() |
150 |
ns3.Simulator.Destroy() |
149 |
#print "Done." |
151 |
#print "Done." |
150 |
|
152 |
|