35.8 Commands at a glance

The following is a list of commands used to setup/manipulate TCP flows for simulations:

set tcp0 [new Agent/TCP]
This creates an instance of a TCP agent. There are several flavors of TCP-sender and TCP-receiver (or sink) agent currently implemented in ns. TCP-senders currently available are: Agent/TCP, Agent/TCP/Reno, Agent/TCP/Newreno, Agent/TCP/Sack1, Agent/TCP/Vegas, Agent/TCP/Fack.
TCP-receivers currently available are: Agent/TCPSink, Agent/TCPSink/DelAck, Agent/TCPSink/Sack1, Agent/TCPSink/Sack1/DelAck.
There is also a two-way implementation of tcp called Agent/TCP/FullTcp. For details on the different TCP flavors see earlier sections of this chapter.

Configuration parameters for TCP flows maybe set as follows:
$tcp set window_ wnd-size
For all possible configuration parameters available for TCP see section 35.1.4. The default configuration values can also be found in ns/tcl/lib/ns-default.tcl.

Following is an example of a simple TCP connection setup:
set tcp [new Agent/TCP] # create tcp agent;
\$ns\_ attach-agent \$node\_(s1) \$tcp # bind src to node;
\$tcp set fid\_ 0   # set flow ID field;
set ftp [new Application/FTP]   # create ftp traffic;
\$ftp attach-agent \$tcp  # bind ftp traffic to tcp agent;
set sink [new Agent/TCPSink] # create tcpsink agent;
\$ns\_ attach-agent \$node\_(k1) \$sink # bind sink to node;
\$sink set fid\_ 0  # set flow ID field;
\$ns\_ connect \$ftp \$sink # active connection src to sink;
\$ns\_ at \$start-time "\$ftp start"  # start ftp flow;

For an example of setting up a full-tcp connection see section 35.3.1.

Tom Henderson 2011-11-05