examples/simple-error-model.cc
changeset 2890 172baa5960ff
parent 2889 969d4f6ab9ba
child 2927 73b47ce1d805
child 2996 a83b94e277d4
--- a/examples/simple-error-model.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/simple-error-model.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -42,6 +42,7 @@
 #include "ns3/core-module.h"
 #include "ns3/common-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/global-route-manager.h"
 
@@ -120,29 +121,33 @@
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
-  OnOffHelper onoff;
-  onoff.SetUdpRemote (i3i2.GetAddress (1), port);
-  onoff.SetAppAttribute ("OnTime", ConstantVariable(1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable(0));
+
+  OnOffHelper onoff ("ns3::Udp",
+    Address (InetSocketAddress (i3i2.GetAddress (1), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable(1));
+  onoff.SetAttribute ("OffTime", ConstantVariable(0));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start(Seconds(1.0));
   apps.Stop (Seconds(10.0));
 
   // Create an optional packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (3));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a similar flow from n3 to n1, starting at time 1.1 seconds
-  onoff.SetUdpRemote (i1i2.GetAddress (0), port);
+  onoff.SetAttribute ("Remote", 
+    Address (InetSocketAddress (i1i2.GetAddress (0), port)));
   apps = onoff.Install (c.Get (3));
   apps.Start(Seconds(1.1));
   apps.Stop (Seconds(10.0));
 
   // Create a packet sink to receive these packets
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  sink.SetAttribute ("Local", 
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (1));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));