src/csma/examples/csma-broadcast.cc
changeset 9000 3ec20a64fd08
parent 8966 060dba23e9bb
equal deleted inserted replaced
8999:7548373564e7 9000:3ec20a64fd08
    90   // Create the OnOff application to send UDP datagrams of size
    90   // Create the OnOff application to send UDP datagrams of size
    91   // 512 bytes (default) at a rate of 500 Kb/s (default) from n0
    91   // 512 bytes (default) at a rate of 500 Kb/s (default) from n0
    92   NS_LOG_INFO ("Create Applications.");
    92   NS_LOG_INFO ("Create Applications.");
    93   OnOffHelper onoff ("ns3::UdpSocketFactory", 
    93   OnOffHelper onoff ("ns3::UdpSocketFactory", 
    94                      Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
    94                      Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
    95   onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
    95   onoff.SetConstantRate (DataRate ("500kb/s"));
    96   onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
       
    97 
    96 
    98   ApplicationContainer app = onoff.Install (c0.Get (0));
    97   ApplicationContainer app = onoff.Install (c0.Get (0));
    99   // Start the application
    98   // Start the application
   100   app.Start (Seconds (1.0));
    99   app.Start (Seconds (1.0));
   101   app.Stop (Seconds (10.0));
   100   app.Stop (Seconds (10.0));