examples/wifi-adhoc.cc
changeset 3100 70b98532fe5c
parent 2997 caf9d364c6fc
child 3102 a225be367c1d
--- a/examples/wifi-adhoc.cc	Mon Apr 28 21:33:15 2008 -0700
+++ b/examples/wifi-adhoc.cc	Mon Apr 28 21:45:55 2008 -0700
@@ -38,7 +38,7 @@
   Experiment (std::string name);
   GnuplotDataset Run (const WifiHelper &wifi);
 private:
-  void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address);
+  void ReceivePacket (Ptr<Socket> socket);
   void SetPosition (Ptr<Node> node, Vector position);
   Vector GetPosition (Ptr<Node> node);
   void AdvancePosition (Ptr<Node> node);
@@ -90,9 +90,15 @@
 }
 
 void
-Experiment::ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address)
+Experiment::ReceivePacket (Ptr<Socket> socket)
 {
-  m_bytesTotal += packet->GetSize ();
+  Ptr<Packet> packet;
+  uint32_t maxSize = std::numeric_limits<uint32_t>::max();
+  uint32_t flags = 0;  // no flags
+  while (packet = socket->Recv (maxSize, flags))
+    {
+      m_bytesTotal += packet->GetSize ();
+    }
 }
 
 Ptr<Socket>
@@ -102,7 +108,7 @@
   Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
   Ptr<Socket> sink = socketFactory->CreateSocket ();
   sink->Bind ();
-  sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
+  sink->SetRecv_Callback (MakeCallback (&Experiment::ReceivePacket, this));
   return sink;
 }