equal
deleted
inserted
replaced
66 NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1)); |
66 NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1)); |
67 NodeContainer c1 = NodeContainer (c.Get (0), c.Get (2)); |
67 NodeContainer c1 = NodeContainer (c.Get (0), c.Get (2)); |
68 |
68 |
69 NS_LOG_INFO ("Build Topology."); |
69 NS_LOG_INFO ("Build Topology."); |
70 CsmaHelper csma; |
70 CsmaHelper csma; |
71 csma.SetChannelParameter ("BitRate", DataRate(5000000)); |
71 csma.SetChannelParameter ("BitRate", DataRateValue (DataRate(5000000))); |
72 csma.SetChannelParameter ("Delay", MilliSeconds(2)); |
72 csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds(2))); |
73 |
73 |
74 NetDeviceContainer n0 = csma.Install (c0); |
74 NetDeviceContainer n0 = csma.Install (c0); |
75 NetDeviceContainer n1 = csma.Install (c1); |
75 NetDeviceContainer n1 = csma.Install (c1); |
76 |
76 |
77 |
77 |
95 // Create the OnOff application to send UDP datagrams of size |
95 // Create the OnOff application to send UDP datagrams of size |
96 // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 |
96 // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 |
97 NS_LOG_INFO ("Create Applications."); |
97 NS_LOG_INFO ("Create Applications."); |
98 OnOffHelper onoff ("ns3::Udp", |
98 OnOffHelper onoff ("ns3::Udp", |
99 Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port))); |
99 Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port))); |
100 onoff.SetAttribute ("OnTime", ConstantVariable (1)); |
100 onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
101 onoff.SetAttribute ("OffTime", ConstantVariable (0)); |
101 onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
102 |
102 |
103 ApplicationContainer app = onoff.Install (c0.Get (0)); |
103 ApplicationContainer app = onoff.Install (c0.Get (0)); |
104 // Start the application |
104 // Start the application |
105 app.Start (Seconds (1.0)); |
105 app.Start (Seconds (1.0)); |
106 app.Stop (Seconds (10.0)); |
106 app.Stop (Seconds (10.0)); |