The following is a list of commands used to setup/manipulate TCP flows for simulations:
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.