From fbf3dd3cf7ad93a0e66955b35bb14c495f73312e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 23 Sep 2008 16:31:54 -0700 Subject: [PATCH] make sure that the sinks are started --- examples/csma-bridge.cc | 12 +++++++----- examples/csma-bridge.py | 13 +++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/csma-bridge.cc b/examples/csma-bridge.cc index 0db4e9055..4d99b4e24 100644 --- a/examples/csma-bridge.cc +++ b/examples/csma-bridge.cc @@ -127,19 +127,21 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address::GetAny (), port))); - sink.Install (terminals.Get (1)); + app = sink.Install (terminals.Get (1)); + app.Start (Seconds (0.0)); // // Create a similar flow from n3 to n0, starting at time 1.1 seconds // onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (Ipv4Address ("10.1.1.1"), port))); - ApplicationContainer app2 = onoff.Install (terminals.Get (3)); + app = onoff.Install (terminals.Get (3)); + app.Start (Seconds (1.1)); + app.Stop (Seconds (10.0)); - sink.Install (terminals.Get (0)); + app = sink.Install (terminals.Get (0)); + app.Start (Seconds (0.0)); - app2.Start (Seconds (1.1)); - app2.Stop (Seconds (10.0)); // // Configure tracing of all enqueue, dequeue, and NetDevice receive events. diff --git a/examples/csma-bridge.py b/examples/csma-bridge.py index f3b54ff3a..0c8e8e3aa 100644 --- a/examples/csma-bridge.py +++ b/examples/csma-bridge.py @@ -107,19 +107,20 @@ def main(argv): # Create an optional packet sink to receive these packets sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory", ns3.Address(ns3.InetSocketAddress(ns3.Ipv4Address.GetAny(), port))) - sink.Install(ns3.NodeContainer(terminals.Get(1))) + app = sink.Install(ns3.NodeContainer(terminals.Get(1))) + app.Start (ns3.Seconds (0.0)) # # Create a similar flow from n3 to n0, starting at time 1.1 seconds # onoff.SetAttribute("Remote", ns3.AddressValue(ns3.InetSocketAddress(ns3.Ipv4Address("10.1.1.1"), port))) - app2 = onoff.Install(ns3.NodeContainer(terminals.Get(3))) + app = onoff.Install(ns3.NodeContainer(terminals.Get(3))) + app.Start(ns3.Seconds(1.1)) + app.Stop(ns3.Seconds(10.0)) - sink.Install(ns3.NodeContainer(terminals.Get(0))) - - app2.Start(ns3.Seconds(1.1)) - app2.Stop(ns3.Seconds(10.0)) + app = sink.Install(ns3.NodeContainer(terminals.Get(0))) + app.Start (ns3.Seconds (0.0)) # # Configure tracing of all enqueue, dequeue, and NetDevice receive events.