0% found this document useful (0 votes)
54 views

Zanobia Nisar: TCP, Udp, FTP Over TCP

This document discusses how to create simulations in NS2 using TCP, UDP, and FTP protocols. It explains that traffic sources need to be attached to transport layer agents, which then need to be attached to nodes. It provides instructions for creating TCP and UDP agents, attaching them to nodes, establishing connections between them and sinks, and attaching an FTP application to a TCP agent.

Uploaded by

suituniv
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Zanobia Nisar: TCP, Udp, FTP Over TCP

This document discusses how to create simulations in NS2 using TCP, UDP, and FTP protocols. It explains that traffic sources need to be attached to transport layer agents, which then need to be attached to nodes. It provides instructions for creating TCP and UDP agents, attaching them to nodes, establishing connections between them and sinks, and attaching an FTP application to a TCP agent.

Uploaded by

suituniv
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

TCP, UDP, FTP over TCP

Zanobia Nisar

In creating simulations in NS2, the three basic terms are:


Traffic Sources: application layer protocols (FTP, Telnet)

Agents: Transport Layer Protocols (FTP, UDP)


Nodes: End Systems

Sources need to be attached to agents and agents to nodes

Create a TCP agent: where TCP agent is an object of and specify its class Agent/TCP
set tcp [new Agent/TCP]

Specify the type of packet

$tcp set class_ 2

Attach agent object created to a node object using the attach-agent member function.
$ns attach-agent $n0 $tcp

This function calls the attach member function of specified nodes which attaches given agent to itself.

Create TCP sink agent: it generates and sends ACK packets to the sender and terminate or frees the received packets
set sink [new Agent/TCPSink]

Use the attach-agent member function to specify which node will act as a sink agent as
$ns attach-agent $n3 $sink

Establish logical network connection between the two agents created


$ns connect $tcp $sink

Set the color of the packet


$tcp set fid_ 1

Create UDP agent as


set udp [new Agent/UDP]

Use attach-agent member function to attach agent created to node object


$ns attach-agent $n1 $udp

Create a null agent: this agent will the receive the packets and frees them
set null [new Agent/Null]

To attach null agent to UDP agent use the attach-agent member function as
$ns attach-agent $n3 $null

Establish logical network connection between the two agents created


$ns connect $udp $null

Set the color of the packet


$udp set fid_ 2

Create an FTP agent


set ftp [new Application/FTP]

Each agent object has a member function attach-agent that attaches a traffic source object to itself
$ftp attach-agent $tcp

You might also like