36.3.1.0.1 Creating the Agent

# set up connection (do not use "create-connection" method because 
# we need a handle on the sink object)
set src [new Agent/TCP/FullTcp] # create agent;
set sink [new Agent/TCP/FullTcp] # create agent;
$ns_ attach-agent $node_(s1) $src # bind src to node;
$ns_ attach-agent $node_(k1) $sink # bind sink to node;
$src set fid_ 0   # set flow ID field;
$sink set fid_ 0  # set flow ID field;
$ns_ connect $src $sink # active connection src to sink;

# set up TCP-level connections
$sink listen # will figure out who its peer is;
$src set window_ 100;

The creation of the FullTcp agent is similar to the other agents, but the sink is placed in a listening state by the listen method. Because a handle to the receiving side is required in order to make this call, the create-connection call used above cannot be used.



Tom Henderson 2014-12-17