src/csma/examples/csma-broadcast.cc
changeset 8966 060dba23e9bb
parent 7256 b04ba6772f8c
child 9000 3ec20a64fd08
equal deleted inserted replaced
8965:cfed4f87e003 8966:060dba23e9bb
    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", RandomVariableValue (ConstantVariable (1)));
    95   onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
    96   onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
    96   onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
    97 
    97 
    98   ApplicationContainer app = onoff.Install (c0.Get (0));
    98   ApplicationContainer app = onoff.Install (c0.Get (0));
    99   // Start the application
    99   // Start the application
   100   app.Start (Seconds (1.0));
   100   app.Start (Seconds (1.0));
   101   app.Stop (Seconds (10.0));
   101   app.Stop (Seconds (10.0));