34.2 Commands at a glance
The following commands are used to setup UDP agents in simulation scripts:
set udp0 [new Agent/UDP]
This creates an instance of the UDP agent.
$ns_ attach-agent node agent
This is a common command used to attach any <agent> to a given <node>.
$traffic-gen attach-agent agent
This a class Application/Traffic/<traffictype> method which connects the
traffic generator to the given <agent>. For example, if we want to setup
a CBR traffic flow for the udp agent, udp1, we given the following commands
set cbr1 [new Application/Traffic/CBR]
\$cbr1 attach-agent \$udp1
$ns_ connect src-agent dst-agent
This command sets up an end-to-end connection between two agents (at the
transport layer).
\$udp set packetSize\_ \<pktsize\>
\$udp set dst\_addr\_ \<address\>
\$udp set dst\_port\_ \<portnum\>
\$udp set class\_ \<class-type\>
\$udp set ttl\_ \<time-to-live\>
..... etc
The above are different parameter values that may be set as shown above
for udp agents. The default values can be found in
ns/tcl/lib/ns-default.tcl.
For a typical example of setting up an UDP agent used in a simulation, see
the above section
34.1.
Tom Henderson
2011-11-05