next up previous contents index
Next: 29. Agent/SRM Up: 28. TCP Agents Previous: 28.7 One-Way Trace TCP

28.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 28.1.4. The default configuration values can also be found in /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 28.3.1.