examples/csma-one-subnet.cc
changeset 2602 d9262bff6df2
parent 2600 6c389d0c717d
child 2801 edbd094336b5
equal deleted inserted replaced
2601:4297e8c61615 2602:d9262bff6df2
   159 //
   159 //
   160   NS_LOG_INFO ("Create Applications.");
   160   NS_LOG_INFO ("Create Applications.");
   161   uint16_t port = 9;   // Discard port (RFC 863)
   161   uint16_t port = 9;   // Discard port (RFC 863)
   162   Ptr<OnOffApplication> ooff = 
   162   Ptr<OnOffApplication> ooff = 
   163     CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.2", port)), 
   163     CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.2", port)), 
   164                                     "Protocol", TypeId::LookupByName ("Udp"),
   164                                     "Protocol", TypeId::LookupByName ("ns3::Udp"),
   165                                     "OnTime", ConstantVariable(1), 
   165                                     "OnTime", ConstantVariable(1), 
   166                                     "OffTime", ConstantVariable(0));
   166                                     "OffTime", ConstantVariable(0));
   167   n0->AddApplication (ooff);
   167   n0->AddApplication (ooff);
   168 
   168 
   169 //
   169 //
   173   ooff->Stop (Seconds(10.0));
   173   ooff->Stop (Seconds(10.0));
   174 // 
   174 // 
   175 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
   175 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
   176 //
   176 //
   177   ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.1", port)), 
   177   ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.1", port)), 
   178                                          "Protocol", TypeId::LookupByName ("Udp"),
   178                                          "Protocol", TypeId::LookupByName ("ns3::Udp"),
   179                                          "OnTime", ConstantVariable(1), 
   179                                          "OnTime", ConstantVariable(1), 
   180                                          "OffTime", ConstantVariable(0));
   180                                          "OffTime", ConstantVariable(0));
   181   n3->AddApplication (ooff);
   181   n3->AddApplication (ooff);
   182 
   182 
   183   ooff->Start(Seconds(1.1));
   183   ooff->Start(Seconds(1.1));