examples/csma-one-subnet.cc
changeset 1514 addb79f47ba5
parent 1504 36ecc970ba96
child 2230 9f13ac3291e0
equal deleted inserted replaced
1513:d16f6fd70397 1514:addb79f47ba5
   162     Ipv4Mask("255.255.255.0"));
   162     Ipv4Mask("255.255.255.0"));
   163 //
   163 //
   164 // Create an OnOff application to send UDP datagrams from node zero to node 1.
   164 // Create an OnOff application to send UDP datagrams from node zero to node 1.
   165 //
   165 //
   166   NS_LOG_INFO ("Create Applications.");
   166   NS_LOG_INFO ("Create Applications.");
       
   167   uint16_t port = 9;   // Discard port (RFC 863)
   167   Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
   168   Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
   168     n0, 
   169     n0, 
   169     InetSocketAddress ("10.1.1.2", 80), 
   170     InetSocketAddress ("10.1.1.2", port), 
   170     "Udp",
   171     "Udp",
   171     ConstantVariable(1), 
   172     ConstantVariable(1), 
   172     ConstantVariable(0));
   173     ConstantVariable(0));
   173 //
   174 //
   174 // Tell the application when to start and stop.
   175 // Tell the application when to start and stop.
   178 // 
   179 // 
   179 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
   180 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
   180 //
   181 //
   181   ooff = Create<OnOffApplication> (
   182   ooff = Create<OnOffApplication> (
   182     n3, 
   183     n3, 
   183     InetSocketAddress ("10.1.1.1", 80), 
   184     InetSocketAddress ("10.1.1.1", port), 
   184     "Udp",
   185     "Udp",
   185     ConstantVariable(1), 
   186     ConstantVariable(1), 
   186     ConstantVariable(0));
   187     ConstantVariable(0));
   187 
   188 
   188   ooff->Start(Seconds(1.1));
   189   ooff->Start(Seconds(1.1));