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

Re: command line argument for ns?



Tan Su Wei wrote:

> Dear all,
>     I'd a question here,
> can we passed command line argument to ns like in c / tcl.
> for example :
> ns sim_script.tcl arg1 arg2 ... ...
>
> Thank you .
> Regards
> Tan Su Wei

yes it's possible with tcl
argv is a list wich reprepresent the arguments, (you should use lindex )

and argc the number of arguments
for example
ns ___.tcl 1000 FQ
and code contains something like
if { $argc != 2} {
    puts stderr {usage: ns ___.tcl pktsize queue}
    exit 1
}
Agent/TCP set packetSize_ [lindex $argv 0]
$ns duplex-link $node3 $node4 1.5Mb 10ms [lindex $argv 1]

Good luck
Ibtissam