[ns] important: TCP packet size

Levinsohn Chris M CMLEVINSOHN at qinetiq.com
Fri Apr 25 00:37:38 PDT 2008


Use the following code:

# setup a tcp connection across the n8-n18 link
# create a new tcp agent called tcp818
set tcp818 [new Agent/TCP]
# Set the source to be node n8
$ns attach-agent $n(8) $tcp818
# create a new TCP sink agent called sink
set sink818 [new Agent/TCPSink]
# set the sink to be node n18
$ns attach-agent $n(18) $sink818
# establish the TCP link between node n8 and node n18
$ns connect $tcp818 $sink818
# this assigns a flow indicator so flows can be distinguished in NAM
$tcp818 set fid_ 3
# this sets the packetsize to 1460bytes, the default is 1000bytes.
$tcp818 set packetSize_ 1460

# define an CBR application to go across CBR link cbr818
set cbr818 [new Application/Traffic/CBR]
$cbr818 attach-agent $tcp818
$cbr818 set packetSize_ 1460
$cbr818 set rate_ 200Mb
$cbr818 set random_ false

I have been using CBRs for most of my TCP testing, however if you wanted
to use FTP then the following code should replace the CBR section:

set ftp818 [new Application/FTP]
$ftp818 attach-agent $tcp818

I don't know if it's necessary to set the packetSize for TCP and CBR,
however seeing as there was the option I thought it was safest!
Anyway... it appears to work. There is something worth noting however,
in the trace file the file size will be 1500, as this is the total size
of the IP packet.

Hope this helps!

Chris Levinsohn
Communication Systems Engineer, Comms South 

The information contained in this E-Mail and any subsequent 
correspondence is private and is intended solely for the intended 
recipient(s).  The information in this communication may be 
confidential and/or legally privileged.  Nothing in this e-mail is 
intended to conclude a contract on behalf of QinetiQ or make QinetiQ 
subject to any other legally binding commitments, unless the e-mail 
contains an express statement to the contrary or incorporates a formal Purchase Order.

For those other than the recipient any disclosure, copying, 
distribution, or any action taken or omitted to be taken in reliance 
on such information is prohibited and may be unlawful.

Emails and other electronic communication with QinetiQ may be 
monitored and recorded for business purposes including security, audit 
and archival purposes.  Any response to this email indicates consent 
to this.

Telephone calls to QinetiQ may be monitored or recorded for quality 
control, security and other business purposes.

QinetiQ Limited
Registered in England & Wales: Company Number:3796233
Registered office: 85 Buckingham Gate, London SW1E 6PD, United Kingdom
Trading address: Cody Technology Park, Cody Building, Ively Road, Farnborough, Hampshire, GU14 0LX, United Kingdom 
http://www.QinetiQ.com/home/legal.html



More information about the Ns-users mailing list