doc/tutorial/conceptual-overview.texi
changeset 3383 f21d3d5926b9
parent 3382 d5f8e5fae1c6
child 3700 fa1c7b813873
equal deleted inserted replaced
3382:d5f8e5fae1c6 3383:f21d3d5926b9
   573 @end verbatim
   573 @end verbatim
   574 
   574 
   575 The first line of code in the above snippet declares the 
   575 The first line of code in the above snippet declares the 
   576 @code{UdpEchoServerHelper}.  As usual, this isn't the application itself, it
   576 @code{UdpEchoServerHelper}.  As usual, this isn't the application itself, it
   577 is an object used to help us create the actual applications.  One of our 
   577 is an object used to help us create the actual applications.  One of our 
   578 conventions is place required attributes in the helper constructor.  In this
   578 conventions is to place required attributes in the helper constructor.  In this
   579 case, the helper can't do anything useful unless it is provided with a port
   579 case, the helper can't do anything useful unless it is provided with a port
   580 number that the client also knows about.  Rather than just picking one and
   580 number that the client also knows about.  Rather than just picking one and
   581 hoping it all works out, we require the port number as a parameter to the 
   581 hoping it all works out, we require the port number as a parameter to the 
   582 constructor.  The constructor, in turn, simply does a @code{SetAttribute}
   582 constructor.  The constructor, in turn, simply does a @code{SetAttribute}
   583 with the passed value.  You can, if desired, set the ``Port'' attribute to
   583 with the passed value.  You can, if desired, set the ``Port'' attribute to
   622 The echo client application is set up in a method substantially similar to
   622 The echo client application is set up in a method substantially similar to
   623 that for the server.  There is an underlying @code{UdpEchoClientApplication}
   623 that for the server.  There is an underlying @code{UdpEchoClientApplication}
   624 that is managed by an @code{UdpEchoClientHelper}.
   624 that is managed by an @code{UdpEchoClientHelper}.
   625 
   625 
   626 @verbatim
   626 @verbatim
   627     UdpEchoClientHelper echoClient;
   627     UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
   628     echoClient.SetRemote (interfaces.GetAddress (1), 9);
   628     echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
   629     echoClient.SetAppAttribute ("MaxPackets", UintegerValue (1));
   629     echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
   630     echoClient.SetAppAttribute ("Interval", TimeValue (Seconds (1.)));
   630     echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
   631     echoClient.SetAppAttribute ("PacketSize", UintegerValue (1024));
       
   632 
   631 
   633     ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
   632     ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
   634     clientApps.Start (Seconds (2.0));
   633     clientApps.Start (Seconds (2.0));
   635     clientApps.Stop (Seconds (10.0));
   634     clientApps.Stop (Seconds (10.0));
   636 @end verbatim
   635 @end verbatim
   637 
   636 
   638 For the echo client, however, we need to set four different attributes.  The 
   637 For the echo client, however, we need to set five different attributes.  The 
   639 first attribute is set using the @code{SetRemote} method.  Recall that
   638 first two attributes are set during construction of the 
   640 we used an @code{Ipv4InterfaceContainer} to keep track of the IP addresses we
   639 @code{UdpEchoClientHelper}.  We pass parameters that are used (internally to
   641 assigned to our devices.  The zeroth interface in the @code{interfaces} 
   640 the helper) to set the ``RemoteAddress'' and ``RemotePort'' attributes in
   642 container is going to coorespond to the IP address of the zeroth node in the 
   641 accordance with our convention to make required attributes parameters in the 
   643 @code{nodes} container.  The first interface in the @code{interfaces} 
   642 helper constructors.  
   644 container cooresponds to the IP address of the first node in the @code{nodes} 
   643 
   645 container.  So, in the following line of code (reproduced from above), we are 
   644 Recall that we used an @code{Ipv4InterfaceContainer} to keep track of the IP 
   646 setting the remote address of the client to be the IP address assigned to the
   645 addresses we assigned to our devices.  The zeroth interface in the 
   647 node on which the server resides.  We also tell it to send packets to port 
   646 @code{interfaces} container is going to coorespond to the IP address of the 
   648 nine while we are at ti.
   647 zeroth node in the @code{nodes} container.  The first interface in the 
   649 
   648 @code{interfaces} container cooresponds to the IP address of the first node 
   650 @verbatim
   649 in the @code{nodes} container.  So, in the first line of code (from above), we
   651     echoClient.SetRemote (interfaces.GetAddress (1), 9);
   650 are creating the helper and telling it so set the remote address of the client
   652 @end verbatim
   651 to be  the IP address assigned to the node on which the server resides.  We 
       
   652 also tell it to arrange to send packets to port nine.
   653 
   653 
   654 The ``MaxPackets'' attribute tells the client the maximum number of packets 
   654 The ``MaxPackets'' attribute tells the client the maximum number of packets 
   655 we allow it to send during the simulation.  The ``Interval'' attribute tells
   655 we allow it to send during the simulation.  The ``Interval'' attribute tells
   656 the client how long to wait between packets, and the ``PacketSize'' attribute
   656 the client how long to wait between packets, and the ``PacketSize'' attribute
   657 tells the client how large its packet payloads should be.  With this 
   657 tells the client how large its packet payloads should be.  With this