author | Craig Dowell <craigdo@ee.washington.edu> |
Sun, 29 Jun 2008 23:14:16 -0700 | |
changeset 3350 | 11e3699b754e |
parent 3348 | fe47da29d783 |
child 3351 | 9042f35c445e |
permissions | -rw-r--r-- |
3332 | 1 |
|
2 |
@c ======================================================================== |
|
3 |
@c Begin document body here |
|
4 |
@c ======================================================================== |
|
5 |
||
6 |
@c ======================================================================== |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
7 |
@c Conceptual Overview |
3332 | 8 |
@c ======================================================================== |
3340 | 9 |
@node Conceptual Overview |
3332 | 10 |
@chapter Conceptual Overview |
11 |
||
12 |
@menu |
|
13 |
* Key Abstractions:: |
|
3350
11e3699b754e
minor tweaks for menus on tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3348
diff
changeset
|
14 |
* A First ns-3 Script:: |
3332 | 15 |
@end menu |
16 |
||
17 |
The first thing we need to do before actually starting to look at or write |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
18 |
@command{ns-3} code is to explain a few core concepts and abstractions in the |
3332 | 19 |
system. Much of this may appear transparently obvious to some, but we |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
20 |
recommend taking the time to read through this section just to ensure you |
3332 | 21 |
are starting on a firm foundation. |
22 |
||
23 |
@node Key Abstractions |
|
24 |
@section Key Abstractions |
|
25 |
||
26 |
In this section, we'll review some terms that are commonly used in |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
27 |
networking, but have a specific meaning in @command{ns-3}. |
3332 | 28 |
|
29 |
@subsection Node |
|
30 |
@cindex Node |
|
31 |
In Internet jargon, a computing device that connects to a network is called |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
32 |
a @emph{host} or sometimes an @emph{end system}. Because @command{ns-3} is a |
3332 | 33 |
@emph{network} simulator, not specifically an @emph{Internet} simulator, we |
34 |
intentionally do not use the term host since it is closely associated with |
|
35 |
the Internet and its protocols. Instead, we use a more generic term also |
|
36 |
used by other simulators that originates in Graph Theory --- the @emph{node}. |
|
37 |
||
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
38 |
@cindex class Node |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
39 |
In @command{ns-3} the basic computing device abstraction is called the |
3332 | 40 |
node. This abstraction is represented in C++ by the class @code{Node}. The |
41 |
@code{Node} class provides methods for managing the representations of |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
42 |
computing devices in simulations. |
3332 | 43 |
|
44 |
You should think of a @code{Node} as a computer to which you will add |
|
45 |
functionality. One adds things like applications, protocol stacks and |
|
46 |
peripheral cards with their associated drivers to enable the computer to do |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
47 |
useful work. We use the same basic model in @command{ns-3}. |
3332 | 48 |
|
49 |
@subsection Application |
|
50 |
@cindex Application |
|
51 |
Typically, computer software is divided into two broad classes. @emph{System |
|
52 |
Software} organizes various computer resources such as memory, processor |
|
53 |
cycles, disk, network, etc., according to some computing model. System |
|
54 |
software usually does not use those resources to complete tasks that directly |
|
55 |
benefit a user. A user would typically run an @emph{application} that acquires |
|
56 |
and uses the resources controlled by the system software to accomplish some |
|
57 |
goal. |
|
58 |
||
59 |
@cindex system call |
|
60 |
Often, the line of separation between system and application software is made |
|
61 |
at the privilege level change that happens in operating system traps. |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
62 |
In @command{ns-3} there is no real concept of operating system and especially |
3332 | 63 |
no concept of privilege levels or system calls. We do, however, have the |
64 |
idea of an application. Just as software applications run on computers to |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
65 |
perform tasks in the ``real world,'' @command{ns-3} applications run on |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
66 |
@command{ns-3} @code{Node}s to drive simulations in the simulated world. |
3332 | 67 |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
68 |
@cindex class Application |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
69 |
In @command{ns-3} the basic abstraction for a user program that generates some |
3332 | 70 |
activity to be simulated is the application. This abstraction is represented |
71 |
in C++ by the class @code{Application}. The @code{Application} class provides |
|
72 |
methods for managing the representations of our version of user-level |
|
73 |
applications in simulations. Developers are expected to specialize the |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
74 |
@code{Application} class in the object-oriented programming sense to create new |
3332 | 75 |
applications. In this tutorial, we will use specializations of class |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
76 |
@code{Application} called @code{UdpEchoClientApplication} and |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
77 |
@code{UdpEchoServerApplication}. As you might expect, these applications |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
78 |
compose a client/server application set used to generate and echo simulated |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
79 |
network packets |
3332 | 80 |
|
81 |
@subsection Channel |
|
82 |
@cindex Channel |
|
83 |
||
84 |
In the real world, one can connect a computer to a network. Often the media |
|
85 |
over which data flows in these netowrks are called @emph{channels}. When |
|
86 |
you connect your Ethernet cable to the plug in the wall, you are connecting |
|
87 |
your computer to an Ethernet communication channel. In the simulated world |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
88 |
of @command{ns-3} one connects a @code{Node} to an object representing a |
3332 | 89 |
communication channel. Here the basic communication subnetwork abstraction |
90 |
is called the channel and is represented in C++ by the class @code{Channel}. |
|
91 |
||
92 |
The @code{Channel} class provides methods for managing communication |
|
93 |
subnetwork objects and connecting nodes to them. They may also be specialized |
|
94 |
by developers in the object oriented programming sense. A @code{Channel} |
|
95 |
specialization may model something as simple as a wire. The specialized |
|
96 |
@code{Channel} can also model things as complicated as a large Ethernet |
|
97 |
switch, or three-dimensional space in the case of wireless networks. |
|
98 |
||
99 |
We will use specialized versions of the @code{Channel} called |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
100 |
@code{CsmaChannel}, @code{PointToPointChannel} and @code{WifiChannel} in this |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
101 |
tutorial. The @code{CsmaChannel}, for example, models a version of a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
102 |
communication subnetwork that implements a @emph{carrier sense multiple |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
103 |
access} communication medium. This gives us Ethernet-like functionality. |
3332 | 104 |
|
105 |
@subsection Net Device |
|
106 |
@cindex NetDevice |
|
107 |
@cindex Ethernet |
|
108 |
It used to be the case that if you wanted to connect a computers to a network, |
|
109 |
you had to buy a specific kind of network cable and a hardware device called |
|
110 |
(in PC terminology) a @emph{peripheral card} that needed to be installed in |
|
111 |
your computer. These cards were called Network Interface Cards, or |
|
112 |
@emph{NIC}s. Today most computers come with the network controller hardware |
|
113 |
built in and users don't see these building blocks. |
|
114 |
||
115 |
A NIC will not work without a software driver to control the hardware. In |
|
116 |
Unix (or Linux), a piece of peripheral hardware is classified as a |
|
117 |
@emph{device}. Devices are controlled using @emph{device drivers}, and network |
|
118 |
devices (NICs) are controlled using @emph{network device drivers} |
|
119 |
collectively known as @emph{net devices}. In Unix and Linux you refer |
|
120 |
to these net devices by names such as @emph{eth0}. |
|
121 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
122 |
In @command{ns-3} the @emph{net device} abstraction covers both the software |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
123 |
driver and the simulated hardware. A net device is ``installed'' in a |
3332 | 124 |
@code{Node} in order to enable the @code{Node} to communicate with other |
125 |
@code{Node}s in the simulation via @code{Channel}s. Just as in a real |
|
126 |
computer, a @code{Node} may be connected to more than one @code{Channel} via |
|
127 |
multiple @code{NetDevice}s. |
|
128 |
||
129 |
The net device abstraction is represented in C++ by the class @code{NetDevice}. |
|
130 |
The @code{NetDevice} class provides methods for managing connections to |
|
131 |
@code{Node} and @code{Channel} objects; and may be specialized by developers |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
132 |
in the object-oriented programming sense. We will use the several specialized |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
133 |
versions of the @code{NetDevice} called @code{CsmaNetDevice}, |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
134 |
@code{PointToPointNetDevice}, and @code{WifiNetDevice} in this tutorial. |
3332 | 135 |
Just as an Ethernet NIC is designed to work with an Ethernet network, the |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
136 |
@code{CsmaNetDevice} is designed to work with a @code{CsmaChannel}; the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
137 |
@code{PointToPointNetDevice} is designed to work with a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
138 |
@code{PointToPointChannel} and a @code{WifiNetNevice} is designed to work with |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
139 |
a @code{WifiChannel}. |
3332 | 140 |
|
141 |
@subsection Topology Helpers |
|
142 |
@cindex helper |
|
143 |
@cindex topology |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
144 |
@cindex topology helper |
3332 | 145 |
In a real network, you will find host computers with added (or built-in) |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
146 |
NICs. In @command{ns-3} we would say that you will find @code{Nodes} with |
3332 | 147 |
attached @code{NetDevices}. In a large simulated network you will need to |
148 |
arrange many connections between @code{Node}s, @code{NetDevice}s and |
|
149 |
@code{Channel}s. |
|
150 |
||
151 |
Since connecting @code{NetDevice}s to @code{Node}s, @code{NetDevice}s |
|
152 |
to @code{Channel}s, assigning IP addresses, etc., are such common tasks |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
153 |
in @command{ns-3}, we provide what we call @emph{topology helpers} to make |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
154 |
this as easy as possible. For example, will take several distinct |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
155 |
@command{ns-3} core operations to create a NetDevice, add a MAC address, |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
156 |
connect the net device to a @code{Node}, configure the protocol stack, and |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
157 |
then connect the @code{NetDevice} to a @code{Channel}. More operations would |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
158 |
be required to connect multiple devices onto multipoint channels and then to |
3332 | 159 |
connect networks together into internetworks. We use topology helper objects |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
160 |
to combine those many distinct operations into an easy to use model. |
3332 | 161 |
|
162 |
@c ======================================================================== |
|
163 |
@c A First ns-3 script |
|
164 |
@c ======================================================================== |
|
165 |
@node A First ns-3 Script |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
166 |
@section A First ns-3 script |
3332 | 167 |
@cindex first script |
168 |
If you downloaded the system as was suggested above, you will have a release |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
169 |
of @command{ns-3} in a directory called @code{repos} under your home |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
170 |
directory. Change into that release directory, and you should find a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
171 |
directory structure something like the following: |
3332 | 172 |
|
173 |
@verbatim |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
174 |
AUTHORS examples/ README samples/ utils/ waf.bat* |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
175 |
build/ LICENSE regression/ scratch/ VERSION wscript |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
176 |
doc/ ns3/ RELEASE_NOTES src/ waf* |
3332 | 177 |
@end verbatim |
178 |
||
179 |
@cindex first.cc |
|
180 |
Change into the examples directory. You should see a file named |
|
181 |
@code{first.cc} located there. This is a script that will create a simple |
|
182 |
point-to-point link between two nodes and echo a single packet between the |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
183 |
nodes. Let's take a look at that script line by line. |
3332 | 184 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
185 |
@subsection Boilerplate |
3332 | 186 |
The first line in the file is an emacs mode line. This tells emacs about the |
187 |
formatting conventions (coding style) we use in our source code. |
|
188 |
||
189 |
@verbatim |
|
190 |
/* -*- Mode:C++; c-file-style:''gnu''; indent-tabs-mode:nil; -*- */ |
|
191 |
@end verbatim |
|
192 |
||
193 |
This is always a somewhat controversial subject, so we might as well get it |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
194 |
out of the way immediately. The @code{ns-3} project, like most large |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
195 |
projects, has adopted a coding style to which all contributed code must |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
196 |
adhere. If you want to contribute your code to the project, you will |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
197 |
eventually have to conform to the @command{ns-3} coding standard as described |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
198 |
in the file @code{doc/codingstd.txt}. We recommend that you, well, just get |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
199 |
used to the look and feel of @code{ns-3} code and adopt this standard whenever |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
200 |
you are working with our code. All of the development team have done so. |
3332 | 201 |
The emacs mode line above makes it easier to get the formatting correct if you |
202 |
use the emacs editor. |
|
203 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
204 |
The @command{ns-3} simulator is licentsed using the GNU General Public |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
205 |
License. You will see the appropriate GNU legalese at the head of every file |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
206 |
in the @command{ns-3} distribution. Often you will see a copyright notice for |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
207 |
one of the institutions involved in the @code{ns-3} project and an author |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
208 |
listed. |
3332 | 209 |
|
210 |
@verbatim |
|
211 |
/* |
|
212 |
* This program is free software; you can redistribute it and/or modify |
|
213 |
* it under the terms of the GNU General Public License version 2 as |
|
214 |
* published by the Free Software Foundation; |
|
215 |
* |
|
216 |
* This program is distributed in the hope that it will be useful, |
|
217 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
218 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
219 |
* GNU General Public License for more details. |
|
220 |
* |
|
221 |
* You should have received a copy of the GNU General Public License |
|
222 |
* along with this program; if not, write to the Free Software |
|
223 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
224 |
*/ |
|
225 |
@end verbatim |
|
226 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
227 |
@subsection Module Includes |
3332 | 228 |
The code proper starts with a number of include statements. To help our high |
229 |
level users deal with the large number of include files present in the system, |
|
230 |
we group includes according to relatively large modules. We provide a single |
|
231 |
include file that, in turn, includes all of the include files used in each |
|
232 |
module. Rather than having to look up exactly what header you need, and |
|
233 |
possibly have to get dependencies right, we give you the ability to load a |
|
234 |
group of files at a large granularity. This is not the most efficient approach |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
235 |
but it certainly makes writing scripts much easier. Each of the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
236 |
@command{ns-3} files is placed in a directory called @code{ns3} (under the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
237 |
build directory) to help avoid include file name collisions. |
3332 | 238 |
|
239 |
@verbatim |
|
240 |
#include "ns3/core-module.h" |
|
241 |
#include "ns3/simulator-module.h" |
|
242 |
#include "ns3/node-module.h" |
|
243 |
#include "ns3/helper-module.h" |
|
244 |
@end verbatim |
|
245 |
||
246 |
The @code{ns3/core-module.h} file corresponds to the ns-3 module you will find |
|
247 |
in the directory @code{src/core} in your downloaded release distribution. If |
|
248 |
you list this directory you will find a large number of header files. When |
|
249 |
you do a build, Waf will place public header files in an @code{ns3} directory |
|
250 |
under the appropriate @code{build/debug} or @code{build/optimized} directory |
|
251 |
depending on your configuration. Waf will also automatically generate a module |
|
252 |
include file to load all of the public header files. Since you are following |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
253 |
this tutorial religiously, you will already have done a |
3332 | 254 |
|
255 |
@verbatim |
|
256 |
./waf -d debug configure |
|
257 |
@end verbatim |
|
258 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
259 |
to configure the project to perform debug builds. You will also have done a |
3332 | 260 |
|
261 |
@verbatim |
|
262 |
./waf |
|
263 |
@end verbatim |
|
264 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
265 |
to build the project. So now if you look in the directory |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
266 |
@code{build/debug/ns-3} you will find the four module include files shown |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
267 |
above. You can take a look at the contents to find that these files will |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
268 |
include all of the public includes in the respective modules. |
3332 | 269 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
270 |
@subsection Ns3 Namespace |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
271 |
The next line in the @code{first.cc} script is a namespace declaration. |
3332 | 272 |
|
273 |
@verbatim |
|
274 |
using namespace ns3; |
|
275 |
@end verbatim |
|
276 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
277 |
The @command{ns-3} project is implemented in a C++ namespace called |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
278 |
@code{ns3}. This groups all @command{ns-3}-related declarations in a scope |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
279 |
outside the global namespace, which we hope will help with integration with |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
280 |
other code. The C++ @code{using} statement introduces the @code{ns-3} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
281 |
namespace into the current (global) declarative region. This is a fancy way |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
282 |
of saying that after this declaration, you will not have to type @code{ns3::} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
283 |
scope resolution operator before all of the @code{ns-3} code in order to use |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
284 |
it. If you are unfamiliar with namespaces, please consult almost any C++ |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
285 |
tutorial and compare the @code{ns3} namespace and usage here with instances of |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
286 |
the @code{std} namespace and the @code{using namespace std;} statements you |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
287 |
will often find in discussions of @code{cout} and streams. |
3332 | 288 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
289 |
@subsection Logging |
3332 | 290 |
The next line of the script is the following, |
291 |
||
292 |
@verbatim |
|
293 |
NS_LOG_COMPONENT_DEFINE ("FirstScriptExample"); |
|
294 |
@end verbatim |
|
295 |
||
296 |
We will use this statement as a convenient place to talk about our Doxygen |
|
297 |
documentation system. If you look at the project web site, |
|
298 |
@uref{http://www.nsnam.org,,ns-3 project}, you will find a link to ``Other |
|
299 |
Documentation'' in the navigation bar. If you select this link, you will be |
|
300 |
taken to our documentation page. You will find links to our development |
|
301 |
@code{ns-3-dev} documentation as well as that for our latest release. If you |
|
302 |
select the @code{HTML} link you will be taken to the Doxygen documentation for |
|
303 |
that version. |
|
304 |
||
305 |
Along the left side, you will find a graphical representation of the structure |
|
306 |
of the documentation. A good place to start is the @code{NS-3 Modules} |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
307 |
``book.'' If you expand @code{Modules} you will see a list of @command{ns-3} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
308 |
module documentation. The concept of module here ties directly into the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
309 |
module include files discussed above. It turns out that the @command{ns-3} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
310 |
logging subsystem is part of the @code{core} module, so go ahead and expand |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
311 |
that documentation node. Now, open the @code{Debugging} book and then select |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
312 |
the @code{Logging} page. |
3332 | 313 |
|
314 |
You should now be looking at the Doxygen documentation for the Logging module. |
|
315 |
In the list of @code{#define}s you will see @code{NS_LOG_COMPONENT_DEFINE}. |
|
316 |
It would probably be good to look for the ``Detailed Description'' of the |
|
317 |
logging module now to get a feel for the overall operation and then look at |
|
318 |
the specific @code{NS_LOG_COMPONENT_DEFINE} documentation. I won't duplicate |
|
319 |
the documentation here, but to summarize, this line declares a logging |
|
320 |
component called @code{FirstScriptExample} that allows you to enable and |
|
321 |
disable console message logging by reference to the name. |
|
322 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
323 |
@subsection Main Function |
3332 | 324 |
The next lines of the script you will find are: |
325 |
||
326 |
@verbatim |
|
327 |
int |
|
328 |
main (int argc, char *argv[]) |
|
329 |
{ |
|
330 |
@end verbatim |
|
331 |
||
332 |
This is just the declaration of the main function of your program. Just as in |
|
333 |
any C++ program, you need to define a main function that will be the first |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
334 |
function run. There is nothing at all special here. Your @command{ns-3} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
335 |
script is just a C++ program. |
3332 | 336 |
|
337 |
The next two lines of the script are used to enable two logging components that |
|
338 |
are built into the Echo Client and Echo Server applications: |
|
339 |
||
340 |
@verbatim |
|
341 |
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); |
|
342 |
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); |
|
343 |
@end verbatim |
|
344 |
||
345 |
If you have read over the Logging component documentation you will see that |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
346 |
there are a number of levels of detail that you can enable on each component. |
3332 | 347 |
These two lines of code enable debug logging at the INFO level for echo |
348 |
clients and servers. This will result in the application printing out |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
349 |
messages as packets are sent and received. |
3332 | 350 |
|
351 |
Now we will get directly to the business of creating a topology and running |
|
352 |
a simulation. We will use the topology helper objects to make this job as |
|
353 |
easy as possible. |
|
354 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
355 |
@subsection Topology Helpers |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
356 |
@subsubsection NodeContainer |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
357 |
The next two lines of code in our script will actually create the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
358 |
@command{ns-3} @code{Node} objects that will represent the computers in the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
359 |
simulation. |
3332 | 360 |
|
361 |
@verbatim |
|
362 |
NodeContainer nodes; |
|
363 |
nodes.Create (2); |
|
364 |
@end verbatim |
|
365 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
366 |
Let's find the documentation for the @code{NodeContainer} class before we |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
367 |
continue. Another way to get into the documentation for a given class is via |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
368 |
the @code{Classes} tab in the Doxygen pages. If you still have the Doxygen |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
369 |
handy, just scroll up to the top of the page and select the @code{Classes} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
370 |
tab. You should see a new set of tabs appear, one of which is |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
371 |
@code{Class List}. Under that tab you will see a list of all of the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
372 |
@command{ns-3} classes. Scroll down, looking for @code{ns3::NodeContainer}. |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
373 |
When you find the class, go ahead and select it to go to the documentation for |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
374 |
the class. |
3332 | 375 |
|
376 |
You may recall that one of our key abstractions is the @code{Node}. This |
|
377 |
represents a computer to which we are going to add things like protocol stacks, |
|
378 |
applications and peripheral cards. The @code{NodeContainer} topology helper |
|
379 |
provides a convenient way to create, manage and access any @code{Node} objects |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
380 |
that we create in order to run a simulation. The first line above just |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
381 |
declares a NodeContainer which we call @code{nodes}. The second line calls the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
382 |
@code{Create} method on the @code{nodes} object that asks the container to |
3332 | 383 |
create two nodes. As described in the Doxygen, the container calls down into |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
384 |
the @command{ns-3} system proper to create two @code{Node} objects and stores |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
385 |
pointers to those objects internally. |
3332 | 386 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
387 |
The nodes as they stand in the script do nothing. The next step in |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
388 |
constructing a topology is to connect our nodes together into a network. |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
389 |
The simplest form of network we support is a single point-to-point link |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
390 |
between two nodes. We'll construct one of those links here. |
3332 | 391 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
392 |
@subsubsection PointToPointHelper |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
393 |
We are constructing a point to point link, and, in a pattern which will become |
3332 | 394 |
quite familiar to you, we use a topology helper object to do the low-level |
395 |
work required to put the link together. Recall that two of our key |
|
396 |
abstractions are the @code{NetDevice} and the @code{Channel}. In the real |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
397 |
world, these terms correspond roughly to peripheral cards and network cables. |
3332 | 398 |
Typically these two things are intimately tied together and one cannot expect |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
399 |
to interchange, for example, Ethernet devices and wireless channels. Our |
3332 | 400 |
Topology Helpers follow this intimate coupling and therefore you will use a |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
401 |
single @code{PointToPointHelper} to configure and connect @command{ns-3} |
3332 | 402 |
@code{PointToPointNetDevice} and @code{PointToPointChannel} objects in this |
403 |
script. |
|
404 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
405 |
The next three lines in the script are, |
3332 | 406 |
|
407 |
@verbatim |
|
408 |
PointToPointHelper pointToPoint; |
|
409 |
pointToPoint.SetDeviceParameter ("DataRate", StringValue ("5Mbps")); |
|
410 |
pointToPoint.SetChannelParameter ("Delay", StringValue ("2ms")); |
|
411 |
@end verbatim |
|
412 |
||
413 |
The first line |
|
414 |
||
415 |
@verbatim |
|
416 |
PointToPointHelper pointToPoint; |
|
417 |
@end verbatim |
|
418 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
419 |
creates a @code{PointToPointHelper} object on the stack. From a high-level |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
420 |
perspective the next line, |
3332 | 421 |
|
422 |
@verbatim |
|
423 |
pointToPoint.SetDeviceParameter ("DataRate", StringValue ("5Mbps")); |
|
424 |
@end verbatim |
|
425 |
||
426 |
tells the @code{PointToPointHelper} object to use the value ``5mbps'' |
|
427 |
(five megabits per second) as the ``DataRate'' when it creates a |
|
428 |
@code{PointToPointNetDevice} object. |
|
429 |
||
430 |
From a more detailed perspective, the string ``DataRate'' corresponds |
|
431 |
to what we call an @code{Attribute} of the @code{PointToPointNetDevice}. |
|
432 |
If you look at the Doxygen for class @code{ns3::PointToPointNetDevice} and |
|
433 |
find the documentation for the @code{GetTypeId} method, you will find a list |
|
434 |
of @code{Attributes} defined for the device. Among these is the ``DataRate'' |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
435 |
attribute. Most user-visible @command{ns-3} objects have similar lists of |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
436 |
attributes. We use this mechanism to easily configure simulations without |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
437 |
recompiling as you will see in a following section. |
3332 | 438 |
|
439 |
Similar to the ``DataRate'' on the @code{PointToPointNetDevice} we find a |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
440 |
``Delay'' attribute associated with the @code{PointToPointChannel}. The |
3332 | 441 |
final line, |
442 |
||
443 |
@verbatim |
|
444 |
pointToPoint.SetChannelParameter ("Delay", StringValue ("2ms")); |
|
445 |
@end verbatim |
|
446 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
447 |
tells the @code{PointToPointHelper} to use the value ``2ms'' (two milliseconds) |
3332 | 448 |
as the value of the transmission delay of every point to point channel it |
449 |
creates. |
|
450 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
451 |
@subsubsection NetDeviceContainer |
3332 | 452 |
At this point in the script, we have a @code{NodeContainer} that contains |
453 |
two nodes. We have a @code{PointToPointHelper} that is primed and ready to |
|
454 |
make @code{PointToPointNetDevices} and wire @code{PoiintToPointChannel} objects |
|
455 |
between them. Just as we used the @code{NodeContainer} topology helper object |
|
456 |
to create the @code{Node}s for our simulation, we will ask the |
|
457 |
@code{PointToPointHelper} to do the work involved in creating, configuring and |
|
458 |
installing our devices for us. We will need to have a list of all of the |
|
459 |
NetDevice objects that are created, so we use a NetDeviceContainer to hold |
|
460 |
them just as we used a NodeContainer to hold the nodes we created. The |
|
461 |
following two lines of code, |
|
462 |
||
463 |
@verbatim |
|
464 |
NetDeviceContainer devices; |
|
465 |
devices = pointToPoint.Install (nodes); |
|
466 |
@end verbatim |
|
467 |
||
468 |
will finish configuring the devices and channel. The first line declares the |
|
469 |
device container mentioned above and the second does the heavy lifting. The |
|
470 |
@code{Install} method of the @code{PointToPointHelper} takes a |
|
471 |
@code{NodeContainer} as a parameter. Internally, a @code{NetDeviceContainer} |
|
472 |
is created. For each node in the @code{NodeContainer} (there must be exactly |
|
473 |
two for a point-to-point link) a @code{PointToPointNetDevice} is created and |
|
474 |
saved in the device container. A @code{PointToPointChannel} is created and |
|
475 |
the two @code{PointToPointNetDevices} are attached. When objects are created |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
476 |
by the @code{PointToPointHelper}, the attributes previously set in the helper |
3332 | 477 |
are used to initialize the corresponding attributes in the created objects. |
478 |
||
479 |
After executing the the @code{pointToPoint.Install (nodes)} call we will have |
|
480 |
two nodes, each with an installed point-to-point net device and a |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
481 |
point-to-point channel between them. Both devices will be configured to |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
482 |
transmit data at five megabits per second over the channel which has a two |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
483 |
millisecond transmission delay. |
3332 | 484 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
485 |
@subsubsection InternetStackHelper |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
486 |
We now have nodes and devices configured, but we don't have any protocol stacks |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
487 |
installed on our nodes. The next two lines of code will take care of that. |
3332 | 488 |
|
489 |
@verbatim |
|
490 |
InternetStackHelper stack; |
|
491 |
stack.Install (nodes); |
|
492 |
@end verbatim |
|
493 |
||
494 |
The @code{InternetStackHelper} is a topology helper that is to internet stacks |
|
495 |
what the @code{PointToPointHelper} is to point-to-point net devices. The |
|
496 |
@code{Install} method takes a @code{NodeContainer} as a parameter. When it is |
|
497 |
executed, it will install an Internet Stack (TCP, UDP, IP, etc.) on each of |
|
498 |
the nodes in the node container. |
|
499 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
500 |
@subsubsection Ipv4AddressHelper |
3332 | 501 |
Next we need to associate the devices on our nodes with IP addresses. We |
502 |
provide a topology helper to manage the allocation of IP addresses. The only |
|
503 |
user-visible API is to set the base IP address and network mask to use when |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
504 |
performing the actual address allocation (which is done at a lower level |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
505 |
inside the helper). |
3332 | 506 |
|
507 |
The next two lines of code in our example script, @code{first.cc}, |
|
508 |
||
509 |
@verbatim |
|
510 |
Ipv4AddressHelper address; |
|
511 |
address.SetBase ("10.1.1.0", "255.255.255.0"); |
|
512 |
@end verbatim |
|
513 |
||
514 |
declare an address helper object and tell it that it should begin allocating IP |
|
515 |
addresses from the network 10.1.1.0 using the mask 255.255.255.0 to define |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
516 |
the allocatable bits. By default the addresses allocated will start at one |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
517 |
and increase monotonically, so the first address allocated from this base will |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
518 |
be 10.1.1.1, followed by 10.1.1.2, etc. The low level @command{ns-3} system |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
519 |
actually remembers all of the IP addresses allocated and will generate a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
520 |
fatal error if you accidentally cause the same address to be generated twice |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
521 |
(which is a very hard to find error, by the way). |
3332 | 522 |
|
523 |
The next line of code, |
|
524 |
||
525 |
@verbatim |
|
526 |
Ipv4InterfaceContainer interfaces = address.Assign (devices); |
|
527 |
@end verbatim |
|
528 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
529 |
performs the actual address assignment. In @command{ns-3} we make the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
530 |
association between an IP address and a device using an @code{Ipv4Interface} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
531 |
object. Just as we sometimes need a list of net devices created by a helper |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
532 |
for future reference we sometimes need a list of @code{Ipv4Interface} objects. |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
533 |
The @code{Ipv4InterfaceContainer} provides this functionality. |
3332 | 534 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
535 |
Now we have a point-to-point network built, with stacks installed and IP |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
536 |
addresses assigned. What we need at this point are applications to generate |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
537 |
traffic. |
3332 | 538 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
539 |
@subsection Applications |
3332 | 540 |
Another one of the core abstractions of the ns-3 system is the |
541 |
@code{Application}. In this script we use two specializations of the core |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
542 |
@command{ns-3} class @code{Application} called @code{UdpEchoServerApplication} |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
543 |
and @code{UdpEchoClientApplication}. Just as we have in our previous |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
544 |
explanations, we use helper objects to help configure and manage the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
545 |
underlying objects. Here, we use @code{UdpEchoServerHelper} and |
3332 | 546 |
@code{UdpEchoClientHelper} objects to make our lives easier. |
547 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
548 |
@subsubsection UdpEchoServerHelper |
3332 | 549 |
The following lines of code in our example script, @code{first.cc}, are used |
550 |
to set up a UDP echo server application on one of the nodes we have previously |
|
551 |
created and connected using a point-to-point link. |
|
552 |
||
553 |
@verbatim |
|
554 |
UdpEchoServerHelper echoServer; |
|
555 |
echoServer.SetPort (9); |
|
556 |
||
557 |
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1)); |
|
558 |
serverApps.Start (Seconds (1.0)); |
|
559 |
serverApps.Stop (Seconds (10.0)); |
|
560 |
@end verbatim |
|
561 |
||
562 |
The first line of code in the above snippet declares the |
|
563 |
@code{UdpEchoServerHelper}. As usual, this isn't the application itself, it |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
564 |
is an object used to help us create the actual applications. The second line |
3332 | 565 |
that has the @code{SetPort} call, is used to tell the helper to assign the |
566 |
value nine to the ``Port'' attribute when creating |
|
567 |
@code{UdpEchoServerApplication} objects. |
|
568 |
||
569 |
Similar to many other helper objects, the @code{UdpEchoServerHelper} object |
|
570 |
has an @code{Install} method. It is the execution of this method that actually |
|
571 |
causes the underlying echo server application to be instantiated and attached |
|
572 |
to a node. Interestingly, the @code{Install} method takes a |
|
573 |
@code{NodeContainter} as a parameter just as the other @code{Install} methods |
|
574 |
we have seen. This is actually what is passed to the method even though it |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
575 |
doesn't look so in this case. There is a C++ @emph{implicit conversion} at |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
576 |
work here. |
3332 | 577 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
578 |
We now see that @code{echoServer.Install} is going to install a |
3332 | 579 |
@code{UdpEchoServerApplication} on the node found at index number one of the |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
580 |
@code{NodeContainer} we used to manage our nodes. @code{Install} will return |
3332 | 581 |
a container that has all of the applications (one in this case since we passed |
582 |
a @code{NodeContainer} containing one node) made by the helper. |
|
583 |
||
584 |
Applications require a time to ``start'' generating traffic and a time to |
|
585 |
``stop.'' These times are set using @code{ApplicationContainer} methods |
|
586 |
@code{Start} and @code{Stop}. These methods take @code{Time} parameters. |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
587 |
In this case, we use an explicit conversion sequence to take the C++ double |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
588 |
1.0 and convert it to an @command{ns-3} @code{Time} object using a |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
589 |
@code{Seconds ()} cast. The two lines, |
3332 | 590 |
|
591 |
@verbatim |
|
592 |
serverApps.Start (Seconds (1.0)); |
|
593 |
serverApps.Stop (Seconds (10.0)); |
|
594 |
@end verbatim |
|
595 |
||
596 |
will cause the echo server application to @code{Start} (enable itself) at one |
|
597 |
second into the simulation and to @code{Stop} (disable itself) at ten seconds |
|
598 |
into the simulation. By virtue of the fact that we have implicilty declared |
|
599 |
a simulation event at ten seconds, the simulation will last at least ten |
|
600 |
seconds. |
|
601 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
602 |
@subsubsection UdpEchoClientHelper |
3332 | 603 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
604 |
The echo client application is set up in a substantially method similar to the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
605 |
server. There is an underlying @code{UdpEchoClientApplication} that is |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
606 |
managed by an @code{UdpEchoClientHelper}. |
3332 | 607 |
|
608 |
@verbatim |
|
609 |
UdpEchoClientHelper echoClient; |
|
610 |
echoClient.SetRemote (interfaces.GetAddress (1), 9); |
|
611 |
echoClient.SetAppAttribute ("MaxPackets", UintegerValue (1)); |
|
612 |
echoClient.SetAppAttribute ("Interval", TimeValue (Seconds (1.))); |
|
613 |
echoClient.SetAppAttribute ("PacketSize", UintegerValue (1024)); |
|
614 |
||
615 |
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0)); |
|
616 |
clientApps.Start (Seconds (2.0)); |
|
617 |
clientApps.Stop (Seconds (10.0)); |
|
618 |
@end verbatim |
|
619 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
620 |
For the echo client, however, we need to set four different attributes. The |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
621 |
first attribute is set using the @code{SetRemote} method. Recall that |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
622 |
we used an @code{Ipv4InterfaceContainer} to keep track of the IP addresses we |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
623 |
assigned to our devices. As a result of the allocation, the zeroth interface |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
624 |
in the @code{interfaces} container cooresponds to the IP address of the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
625 |
zeroth node in the @code{nodes} container. The first interface in the |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
626 |
@code{interfaces} container cooresponds to the IP address of the first node in |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
627 |
the @code{nodes} container. So, in the following line of code (reproduced |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
628 |
from above), we are setting the remote address of the client to be the IP |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
629 |
address assigned to the node on which the server resides, and we tell it to |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
630 |
send packets to port nine. |
3332 | 631 |
|
632 |
@verbatim |
|
633 |
echoClient.SetRemote (interfaces.GetAddress (1), 9); |
|
634 |
@end verbatim |
|
635 |
||
636 |
The ``MaxPackets'' attribute tells the client the maximum number of packets |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
637 |
it can send. The ``Interval'' attribute tells the client how long to wait |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
638 |
between packets, and the ``PacketSize'' attribute tells the client how large |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
639 |
its packets should be. With this combination of attributes, we are telling |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
640 |
the client to send one 1024-byte packet. |
3332 | 641 |
|
642 |
Just as in the case of the echo server, we tell the echo client to @code{Start} |
|
643 |
and @code{Stop}, but here we start the client one second after the server is |
|
644 |
enabled (at two seconds into the simulation). |
|
645 |
||
646 |
@subsection Simulator |
|
647 |
What we need to do at this point is to actually run the simulation. This is |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
648 |
done using the global function @code{Simulator::Run}. |
3332 | 649 |
|
650 |
@verbatim |
|
651 |
Simulator::Run (); |
|
652 |
@end verbatim |
|
653 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
654 |
When we previously called the methods, |
3332 | 655 |
|
656 |
@verbatim |
|
657 |
serverApps.Start (Seconds (1.0)); |
|
658 |
serverApps.Stop (Seconds (10.0)); |
|
659 |
... |
|
660 |
clientApps.Start (Seconds (2.0)); |
|
661 |
clientApps.Stop (Seconds (10.0)); |
|
662 |
@end verbatim |
|
663 |
||
664 |
we actually scheduled events in the simulator at 1.0 seconds, 2.0 seconds and |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
665 |
10.0 seconds. When @code{Simulator::Run} is called, the ssytem will begin |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
666 |
looking through the list of scheduled events and executing them. First it |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
667 |
will run the event at 1.0 seconds, which will enable the echo server |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
668 |
application. Then it will run the event scheduled for t=2.0 seconds which |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
669 |
will start the echo client application. The start event implementation in |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
670 |
the echo client will begin the data transfer phase of the simulation by |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
671 |
sending a packet to the server. |
3332 | 672 |
|
673 |
The act of sending the packet to the server will trigger a chain of events |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
674 |
which will be automatically scheduled and which will perform the mechanics of |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
675 |
the packet echo according to the various timing parameters that we have set |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
676 |
in the script. |
3332 | 677 |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
678 |
Eventually, since we only send one packet, the chain of events triggered by |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
679 |
that single client echo request will taper off and the simulation will go |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
680 |
idle. Once this happens, the remaining events will be the @code{Stop} events |
3332 | 681 |
for the server and the client. When these events are executed, there are |
682 |
no further events to process and @code{Simulator::Run} returns. The simulation |
|
683 |
is complete. |
|
684 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
685 |
All that remains is to clean up. This is done by calling the global function |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
686 |
@code{Simulator::Destroy}. As the helper functions (or low level |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
687 |
@command{ns-3} code) executed, they arranged it so that hooks were inserted in |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
688 |
the simulator to destroy all of the objects that were created. You did not |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
689 |
have to keep track of any of these objects yourself --- all you had to do |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
690 |
was to call @code{Simulator::Destroy} and exit. The @command{ns-3} system |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
691 |
took care of the hard part for you. The remaining lines of our first |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
692 |
@command{ns-3} script, @code{first.cc}, do just that: |
3332 | 693 |
|
694 |
@verbatim |
|
695 |
Simulator::Destroy (); |
|
696 |
return 0; |
|
697 |
} |
|
698 |
@end verbatim |
|
699 |
||
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
700 |
@subsection Building Your Script |
3332 | 701 |
We have made it trivial to build your simple scripts. All you have to do is |
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
702 |
to drop your script into the scratch directory and it will automatically be |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
703 |
built if you run Waf. Let's try it. Copy @code{examples/first.cc} into |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
704 |
the @code{scratch} directory. |
3332 | 705 |
|
706 |
@verbatim |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
707 |
~/repos/ns-3-tutorial > cp examples/first.cc scratch/ |
3332 | 708 |
@end verbatim |
709 |
||
710 |
and then build it using waf, |
|
711 |
||
712 |
@verbatim |
|
713 |
~/repos/ns-3-tutorial > ./waf |
|
714 |
Entering directory `/home/craigdo/repos/ns-3-tutorial/build' |
|
715 |
[432/477] cxx: scratch/first.cc -> build/debug/scratch/first_2.o |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
716 |
[475/477] cxx_link: build/debug/scratch/first_2.o ... |
3332 | 717 |
Compilation finished successfully |
718 |
~/repos/ns-3-tutorial > |
|
719 |
@end verbatim |
|
720 |
||
721 |
You can now run the example (note that if you build your program in the scratch |
|
722 |
directory you must run it out of the scratch direcory): |
|
723 |
||
724 |
@verbatim |
|
725 |
~/repos/ns-3-tutorial > ./waf --run scratch/first |
|
726 |
Entering directory `/home/craigdo/repos/ns-3-tutorial/build' |
|
727 |
Compilation finished successfully |
|
728 |
Sent 1024 bytes to 10.1.1.2 |
|
729 |
Received 1024 bytes from 10.1.1.1 |
|
730 |
Received 1024 bytes from 10.1.1.2 |
|
731 |
~/repos/ns-3-tutorial > |
|
732 |
@end verbatim |
|
733 |
||
734 |
Here you see that the build system checks to make sure that the file has been |
|
735 |
build and then runs it. You see the logging component on the echo client |
|
3345
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
736 |
indicate that it has sent one 1024 byte packet to the Echo Server on |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
737 |
10.1.1.2. You also see the logging component on the echo server say that |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
738 |
it has received the 1024 bytes from 10.1.1.1. The echo server silently |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
739 |
echoes the packet and you see the echo client log that it has received its |
b0af63b9f9a6
editing pass through the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3339
diff
changeset
|
740 |
packet back from the server. |