[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] TCP seq nos (fwd)



Hi,

I am a new ns user and am still trying to find my way around.
I have 2 nodes n0 and n1 connected by 1Mb 100ms link. I have attached
FullTcp agents to each of them and am using ftp aplication to
transfer a 10MB file from n0 to n1. Can someone
tell me how do I go about recording seq nos for each of the packets
received at n1 - I need to use xgraph to plot seq nos vs RTT.
Am attaching my code at the end....
Thanx in advance,
Priya

----------------------------------------
#Create a simulator object
set ns [new Simulator]

Trace set show_tcphdr_ 1 ; # needed to plot ack numbers

#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Open the trace file
set f [open fulltcp.tr w]
$ns trace-all $f

#Define a 'finish' procedure
proc finish {} {
        global ns nf f
        $ns flush-trace
        close $f
        #Close the trace file
        close $nf
        #Execute ../nam-1.0a9/nam on the trace file
#        exec ../nam-1.0a9/nam out.nam &
        exit 0
}

set n0 [$ns node]
set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 100ms DropTail

#set the queue size to a large value
set q [[$ns link $n0 $n1] queue]
$q set limit_ 10000

set source [new Agent/TCP/FullTcp]
set sink [new Agent/TCP/FullTcp]


$ns attach-agent $n0 $source
$ns attach-agent $n1 $sink

set ftp [new Application/FTP]
$ftp attach-agent $source

$ns connect $source $sink

#set the pk size
$source set segsize_ 1500
$source set window_ 100

#Call the finish procedure after 5 seconds of simulation time
$ns at 0.5 "$sink listen"

#transfer a 10Mbyte file
$ns at 1.0 "$ftp send 10000000"

# tells the simulation to call "finish"
$ns at 2.0 "finish"

# run the simulation
$ns run