[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] TCP seq nos
On Tue, 3 Apr 2001, Priya Mahadevan wrote:
> Thanks a lot - but even after setting the show_tcphdr_ all the trace file
> gives me is ack number and header length. Is there any way to get the seq
> nos and congestion window size ?
Write out a tracefile that gets it from the bound variable. That's the
entire point of bound variables; grasping this bit (schedule a writing
procedure that schedules itself from then on to record each data
point) seems to be conceptually hard/unfamiliar, but once you have you
can do a lot with ns. The below code snippet should help.
[blah normal tracefiles topology setup nodes link blah]
proc record {} {
global ns tcp0 trace_wnd trace_ack trace_seq
set time_delta 0.01
#Get the variables of interest
set curr_dupack [$tcp0 set dupacks_]
set curr_cwnd [$tcp0 set cwnd_]
set curr_maxseq [expr fmod([$tcp0 set maxseq_], 100)]
#Get the current time
set now [$ns now]
#Write the variables of interest vs. time
puts $trace_ack "$now $curr_dupack"
puts $trace_wnd "$now $curr_cwnd"
puts $trace_seq "$now $curr_maxseq"
#Re-schedule the procedure
$ns at [expr $now+$time_delta] "record"
}
set trace_wnd [open outnewrenoshort.wnd w]
set trace_ack [open outnewrenoshort.dup w]
set trace_seq [open outnewrenoshort.seq w]
# Attach agents
set tcp0 [new Agent/TCP/Newreno]
$ns attach-agent $g(0) $tcp0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$tcp0 set fid_ 1
$ns color 1 Red
$tcp0 set window_ 20
set null0 [new Agent/TCPSink]
$ns attach-agent $g(38) $null0
$ns connect $tcp0 $null0
$ns at 29.0 "record"
$ns at 30.0 "$ftp0 start"
$ns at 200.0 "$ftp0 stop"
$ns at 200.5 "end"
$ns at 201.0 "finish"
proc end {} {
global ns trace_ack trace_wnd trace_seq
close $trace_wnd
close $trace_ack
close $trace_seq
}
and the finish routine closes the 'normal' trace-all and
namtrace-all tracefiles, throws up nam, graphing programs, etc.
L.
<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>