examples/csma-multicast.cc
changeset 2592 3ebf97150166
parent 2577 5b41cb5c3fcf
child 2600 6c389d0c717d
equal deleted inserted replaced
2591:83a605082fb6 2592:3ebf97150166
   276   uint16_t port = 9;   // Discard port (RFC 863)
   276   uint16_t port = 9;   // Discard port (RFC 863)
   277 
   277 
   278   // Configure a multicast packet generator that generates a packet
   278   // Configure a multicast packet generator that generates a packet
   279   // every few seconds
   279   // every few seconds
   280   Ptr<OnOffApplication> ooff = 
   280   Ptr<OnOffApplication> ooff = 
   281     CreateObjectWith<OnOffApplication> (
   281     CreateObject<OnOffApplication> (
   282                                         "Node", n0, 
   282                                         "Node", n0, 
   283                                         "Remote", Address (InetSocketAddress (multicastGroup, port)), 
   283                                         "Remote", Address (InetSocketAddress (multicastGroup, port)), 
   284                                         "Protocol", TypeId::LookupByName ("Udp"),
   284                                         "Protocol", TypeId::LookupByName ("Udp"),
   285                                         "OnTime", ConstantVariable(1), 
   285                                         "OnTime", ConstantVariable(1), 
   286                                         "OffTime", ConstantVariable(0),
   286                                         "OffTime", ConstantVariable(0),
   295 
   295 
   296   // Create an optional packet sink to receive these packets
   296   // Create an optional packet sink to receive these packets
   297   // If you enable logging on this (above) it will print a log statement
   297   // If you enable logging on this (above) it will print a log statement
   298   // for every packet received
   298   // for every packet received
   299   Ptr<PacketSink> sink = 
   299   Ptr<PacketSink> sink = 
   300     CreateObjectWith<PacketSink> (
   300     CreateObject<PacketSink> (
   301                                   "Node", n4,
   301                                   "Node", n4,
   302                                   "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
   302                                   "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
   303                                   "Protocol", TypeId::LookupByName ("Udp"));
   303                                   "Protocol", TypeId::LookupByName ("Udp"));
   304   n4->AddApplication (sink);
   304   n4->AddApplication (sink);
   305   // Start the sink
   305   // Start the sink