author | Mirko Banchi <mk.banchi@gmail.com> |
Fri, 24 Apr 2009 09:07:00 +0200 | |
changeset 4401 | 427cec7079f3 |
parent 4264 | 9d2e96c4e6e4 |
child 4577 | 84c133267507 |
permissions | -rw-r--r-- |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* This program is free software; you can redistribute it and/or modify |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* it under the terms of the GNU General Public License version 2 as |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* published by the Free Software Foundation; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* This program is distributed in the hope that it will be useful, |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* GNU General Public License for more details. |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* You should have received a copy of the GNU General Public License |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* along with this program; if not, write to the Free Software |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
*/ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
// Network topology |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
// n0 n1 n2 n3 |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
// | | | | |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
// ================= |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
// LAN |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
// |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
24 |
// - UDP flows from n0 to n1 and back |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
// - DropTail queues |
1497 | 26 |
// - Tracing of queues and packet receptions to file "udp-echo.tr" |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
|
2788
ad1404dcfad4
port to new pcap/ascii trace helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2768
diff
changeset
|
28 |
#include <fstream> |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
29 |
#include "ns3/core-module.h" |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
30 |
#include "ns3/simulator-module.h" |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
31 |
#include "ns3/helper-module.h" |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
using namespace ns3; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
35 |
NS_LOG_COMPONENT_DEFINE ("UdpEchoExample"); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
int |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
main (int argc, char *argv[]) |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
{ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
40 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
// Users may find it convenient to turn on explicit debugging |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
// for selected modules; the below lines suggest how to do this |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
// |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1497
diff
changeset
|
44 |
#if 0 |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
45 |
LogComponentEnable ("UdpEchoExample", LOG_LEVEL_INFO); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
47 |
LogComponentEnable("Object", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
48 |
LogComponentEnable("Queue", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
49 |
LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
50 |
LogComponentEnable("Channel", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
51 |
LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
52 |
LogComponentEnable("NetDevice", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
53 |
LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
54 |
LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
55 |
LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
56 |
LogComponentEnable("Socket", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
57 |
LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
58 |
LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
59 |
LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
60 |
LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
61 |
LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
62 |
LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
63 |
LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
64 |
LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
65 |
LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
66 |
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
67 |
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
#endif |
2533
80cdc3eec057
do not use Queue::CreateDefault
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
69 |
|
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
// Allow the user to override any of the defaults and the above Bind() at |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
// run-time, via command-line arguments |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |
// |
2575
1aae382e65e2
rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2533
diff
changeset
|
73 |
CommandLine cmd; |
1aae382e65e2
rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2533
diff
changeset
|
74 |
cmd.Parse (argc, argv); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
75 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
76 |
// Explicitly create the nodes required by the topology (shown above). |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
77 |
// |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
78 |
NS_LOG_INFO ("Create nodes."); |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
79 |
NodeContainer n; |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
80 |
n.Create (4); |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
81 |
|
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
82 |
InternetStackHelper internet; |
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2838
diff
changeset
|
83 |
internet.Install (n); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
84 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
85 |
NS_LOG_INFO ("Create channels."); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
86 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
87 |
// Explicitly create the channels required by the topology (shown above). |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
88 |
// |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
89 |
CsmaHelper csma; |
3381
3cdd9d60f7c7
bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents:
3257
diff
changeset
|
90 |
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); |
3cdd9d60f7c7
bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents:
3257
diff
changeset
|
91 |
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); |
3629 | 92 |
csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); |
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2838
diff
changeset
|
93 |
NetDeviceContainer d = csma.Install (n); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
94 |
|
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
95 |
Ipv4AddressHelper ipv4; |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
96 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
97 |
// We've got the "hardware" in place. Now we need to add IP addresses. |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
98 |
// |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
99 |
NS_LOG_INFO ("Assign IP Addresses."); |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
100 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
2888
872dc8466352
Ipv4AddressHelper::Allocate -> Ipv4AddressHelper::Assign
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2887
diff
changeset
|
101 |
Ipv4InterfaceContainer i = ipv4.Assign (d); |
1497 | 102 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
103 |
NS_LOG_INFO ("Create Applications."); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
104 |
// |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
105 |
// Create a UdpEchoServer application on node one. |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1497
diff
changeset
|
106 |
// |
1514
addb79f47ba5
change port number used by example scripts to 'discard' or 'echo' instead of '80'
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
107 |
uint16_t port = 9; // well-known echo port number |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3381
diff
changeset
|
108 |
UdpEchoServerHelper server (port); |
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2838
diff
changeset
|
109 |
ApplicationContainer apps = server.Install (n.Get(1)); |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
110 |
apps.Start (Seconds (1.0)); |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
111 |
apps.Stop (Seconds (10.0)); |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
112 |
|
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1497
diff
changeset
|
113 |
// |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
114 |
// Create a UdpEchoClient application to send UDP datagrams from node zero to |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
115 |
// node one. |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
116 |
// |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
117 |
uint32_t packetSize = 1024; |
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
118 |
uint32_t maxPacketCount = 1; |
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
119 |
Time interPacketInterval = Seconds (1.); |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3381
diff
changeset
|
120 |
UdpEchoClientHelper client (i.GetAddress (1), port); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3381
diff
changeset
|
121 |
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3381
diff
changeset
|
122 |
client.SetAttribute ("Interval", TimeValue (interPacketInterval)); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3381
diff
changeset
|
123 |
client.SetAttribute ("PacketSize", UintegerValue (packetSize)); |
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2838
diff
changeset
|
124 |
apps = client.Install (n.Get (0)); |
2768
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
125 |
apps.Start (Seconds (2.0)); |
fcb615f2c57c
port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
126 |
apps.Stop (Seconds (10.0)); |
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1499
diff
changeset
|
127 |
|
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2788
diff
changeset
|
128 |
std::ofstream ascii; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2788
diff
changeset
|
129 |
ascii.open ("udp-echo.tr"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
3629
diff
changeset
|
130 |
CsmaHelper::EnablePcapAll ("udp-echo", false); |
2996
a83b94e277d4
EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents:
2888
diff
changeset
|
131 |
CsmaHelper::EnableAsciiAll (ascii); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2788
diff
changeset
|
132 |
|
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
133 |
// |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
134 |
// Now, do the actual simulation. |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
135 |
// |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
136 |
NS_LOG_INFO ("Run Simulation."); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
137 |
Simulator::Run (); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
138 |
Simulator::Destroy (); |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
139 |
NS_LOG_INFO ("Done."); |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
140 |
} |