examples/tcp-large-transfer.cc
changeset 3242 309f511aa143
parent 3241 284705f0775f
parent 3116 c33b6d2775b7
child 3243 a4b8da16a324
equal deleted inserted replaced
3241:284705f0775f 3242:309f511aa143
   148 
   148 
   149   ApplicationContainer apps = sink.Install (c1.Get (1));
   149   ApplicationContainer apps = sink.Install (c1.Get (1));
   150   apps.Start (Seconds (0.0));
   150   apps.Start (Seconds (0.0));
   151 
   151 
   152   // and generate traffic to remote sink.
   152   // and generate traffic to remote sink.
   153   Ptr<SocketFactory> socketFactory = 
   153   //TypeId tid = TypeId::LookupByName ("ns3::Tcp");
   154     c0.Get (0)->GetObject<Tcp> ();
   154   Ptr<Socket> localSocket = Socket::CreateSocket (c0.Get (0), Tcp::GetTypeId ());
   155   Ptr<Socket> localSocket = socketFactory->CreateSocket ();
       
   156   localSocket->Bind ();
   155   localSocket->Bind ();
   157   Simulator::ScheduleNow (&StartFlow, localSocket, nBytes,
   156   Simulator::ScheduleNow (&StartFlow, localSocket, nBytes,
   158                           ipInterfs.GetAddress (1), servPort);
   157                           ipInterfs.GetAddress (1), servPort);
   159 
   158 
   160   Config::ConnectWithoutContext ("/NodeList/*/ApplicationList/*/Rx", 
   159   Config::ConnectWithoutContext ("/NodeList/*/ApplicationList/*/Rx", 
   162 
   161 
   163   std::ofstream ascii;
   162   std::ofstream ascii;
   164   ascii.open ("tcp-large-transfer.tr");
   163   ascii.open ("tcp-large-transfer.tr");
   165   PointToPointHelper::EnableAsciiAll (ascii);
   164   PointToPointHelper::EnableAsciiAll (ascii);
   166 
   165 
   167   InternetStackHelper::EnablePcapAll ("tcp-large-transfer");
   166   PointToPointHelper::EnablePcapAll ("tcp-large-transfer");
   168 
   167 
   169   Simulator::StopAt (Seconds(10));
   168   Simulator::StopAt (Seconds(10));
   170   Simulator::Run ();
   169   Simulator::Run ();
   171   Simulator::Destroy ();
   170   Simulator::Destroy ();
   172 }
   171 }