Monday, 17 December 2012

Computer Network Programs



Program No - 1

Aim – The First TCL Script (template)

Program

set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
            global ns nf
            $ns flush-trace
            close $nf
            exec nam out.nam &
            exit 0
}

$ns at 5.0 "finish"
$ns run

Result

C:\Program Files\Tcl\bin>ns program1.tcl                  (Compiling the code)

C:\Program Files\Tcl\bin>nam out.nam                      (Executing the Script)
(‘$ns run’ executes the script automatically.)




















                                                            




No comments:

Post a Comment