[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Serializing TCP communication: New question
I changed my Agent to TCP/Reno and my "done" function works.
But I want to use TCP/FullTcp and that does not work.
I noticed that the sending node doesn't send FIN when
it's finished sending. If I'm reading tcp-full.cc correctly,
the finish() is not called unless the FIN is ACKed, so my
tcp agent doesn't actually think it's done.
I added:
$ns at 0.05 "$ftp0 produce 10"
$ns at 0.30 "$ftp0 produce 10"
and the second produce 10 occurs with no initial SYN SYN/ACK,
so the connection was never dropped...(finish() not called)
I removed the function named "finish" from my script and the
simulation seems to go into an infinite loop, waiting for a FIN.
Do I need to do something so that the tcp connection isn't
persistant?
Thanks for the help so far!
Here is my script:
(rather than switching nodes I print "tcp0 is done" when done)
set nf [open ns.nam w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec ../ns-allinone-2.1b6/nam-1.0a8/nam ns.nam &
exit 0
}
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 10Mb 10ms DropTail
set tcp0 [new Agent/TCP/FullTcp]
$ns attach-agent $n0 $tcp0
set ftp0 [new Source/FTP]
$ftp0 attach $tcp0
$ftp0 set maxpkts 10
set tcp1 [new Agent/TCP/FullTcp]
$ns attach-agent $n1 $tcp1
$tcp1 listen
$ns connect $tcp0 $tcp1
proc thing {} { puts "$self tcp0 is done" }
$tcp0 proc done {} "thing"
$ns at 0.05 "$ftp0 produce 10"
$ns at 0.3 "$ftp0 produce 10"
$ns at 5.0 "finish"
$ns run