--- a/examples/simple-global-routing.cc Sun Sep 09 23:21:47 2007 -0700
+++ b/examples/simple-global-routing.cc Sun Sep 09 23:24:31 2007 -0700
@@ -65,6 +65,7 @@
#include "ns3/ipv4-route.h"
#include "ns3/point-to-point-topology.h"
#include "ns3/onoff-application.h"
+#include "ns3/packet-sink.h"
#include "ns3/global-route-manager.h"
using namespace ns3;
@@ -151,6 +152,17 @@
ooff->Start (Seconds (1.0));
ooff->Stop (Seconds (10.0));
+ // Create a packet sink to receive these packets
+ // The last argument "true" disables output from the Receive callback
+ Ptr<PacketSink> sink = Create<PacketSink> (
+ n3,
+ InetSocketAddress (Ipv4Address::GetAny (), 80),
+ "Udp",
+ true);
+ // Start the sink
+ sink->Start (Seconds (1.0));
+ sink->Stop (Seconds (10.0));
+
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = Create<OnOffApplication> (
n3,
@@ -162,6 +174,16 @@
ooff->Start (Seconds (1.1));
ooff->Stop (Seconds (10.0));
+ // Create a packet sink to receive these packets
+ sink = Create<PacketSink> (
+ n1,
+ InetSocketAddress (Ipv4Address::GetAny (), 80),
+ "Udp",
+ true);
+ // Start the sink
+ sink->Start (Seconds (1.1));
+ sink->Stop (Seconds (10.0));
+
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
// Trace output will be sent to the simple-global-routing.tr file
AsciiTrace asciitrace ("simple-global-routing.tr");
--- a/examples/simple-point-to-point.cc Sun Sep 09 23:21:47 2007 -0700
+++ b/examples/simple-point-to-point.cc Sun Sep 09 23:24:31 2007 -0700
@@ -64,6 +64,7 @@
#include "ns3/ipv4-route.h"
#include "ns3/point-to-point-topology.h"
#include "ns3/onoff-application.h"
+#include "ns3/packet-sink.h"
using namespace ns3;
@@ -153,6 +154,15 @@
ooff->Start(Seconds(1.0));
ooff->Stop (Seconds(10.0));
+ // Create an optional packet sink to receive these packets
+ Ptr<PacketSink> sink = Create<PacketSink> (
+ n3,
+ InetSocketAddress (Ipv4Address::GetAny (), 80),
+ "Udp");
+ // Start the sink
+ sink->Start (Seconds (1.0));
+ sink->Stop (Seconds (10.0));
+
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = Create<OnOffApplication> (
n3,
@@ -164,6 +174,16 @@
ooff->Start(Seconds(1.1));
ooff->Stop (Seconds(10.0));
+ // Create a packet sink to receive these packets
+ sink = Create<PacketSink> (
+ n1,
+ InetSocketAddress (Ipv4Address::GetAny (), 80),
+ "Udp");
+ // Start the sink
+ sink->Start (Seconds (1.1));
+ sink->Stop (Seconds (10.0));
+ sink->SetQuiet (); // disable output from the Receive callback
+
// Here, finish off packet routing configuration
// This will likely set by some global StaticRouting object in the future
Ptr<Ipv4> ipv4;