Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to get the run time arguments in NS2?

  • The number of arguments in the network varies dynamically during the runtime by using the following command
  • Example1:

    if {$argc != 1}
    {
    error "\nCommand: ns filename.tcl \n\n "
    }
    set total_nodes [lindex $argv 0]</li>
    </ul>
    where,

    $argc → number of run time arguments

    lindex $argv 0 → value of the number of nodes

  • Example2:

    if {$argc != 2}
    {
    Error "\nCommand: ns filename.tcl \n\n "
    }
    set total_nodes [lindex $argv 0] ;# 1st run time argument
    set communication range [lindex $argv 1] ;# 2nd run time argument
    where,
    argc -> number of run time arguments.
    lindex $argv 0 → value of the number of nodes
    lindex $argv 1 → value of the communication range