I am newbie at NS2. I am trying to make tcl script and to get as much data as 
it is possible. As output to simulation I have "out.tr", "trace.nam" and 
"out.data" files.

First two files have some data, but the last one "out.data" is empty (0 bytes). 
I don't know why. 

Can you help me with this?


Thanks.

Here si my tcl script>

set ns [new Simulator]
set namFile [open trace.nam w]
set tr_f [open out.tr w]
set record_f [open out.data w]
$ns namtrace-all $namFile
$ns trace-all $tr_f
$ns at 10.0 "finish"
proc finish {} {
global ns
global namFile tr_f record_f
$ns flush-trace
close $namFile
close $tr_f
close $record_f
exec nam trace.nam &
exit 0
}
set SRC [$ns node]
set R1 [$ns node]
set DST [$ns node]
$ns duplex-link $SRC $R1 1Gb 40ms DropTail
set DuplexLink0 [$ns link $SRC $R1]
$ns duplex-link $R1 $DST 100Mb 1ms DropTail
set DuplexLink1 [$ns link $R1 $DST]
set TCP0 [new Agent/TCP]
$TCP0 set window_ 50
$TCP0 set packetSize_ 1500
$TCP0 set fid_ 1
set TCPSink0 [new Agent/TCPSink]
$ns attach-agent $SRC $TCP0
$ns attach-agent $DST $TCPSink0
$ns connect $TCP0 $TCPSink0
set CBR0 [new Application/Traffic/CBR]
$CBR0 set packetSize_ 1500
$CBR0 set random_ 0
$CBR0 attach-agent $TCP0
$ns at .5 "$CBR0 start"
$ns at 4.5 "$CBR0 stop"
$ns run

Reply via email to