#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 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 display the routing table using TCL script in NS2?

Description

Each node involved in the routing process maintains routing table. The function named as dump-table is available in AOMDV protocol. It can be called in TCL script to analyze the routing information such as nexthop, hopcount and destination address available in the routing table.

Sample Code

#Filename: sample1.tcl

set source 0

set destination 8

$ns at 0.0 "$node_($source) label source"

$ns at 0.0 "$node_($destination) label destination"

$ns at 0.0 "$node_($source) color blue"

$ns at 0.0 "$node_($destination) color blue"

# Data transmission from source to destination

set udp [new Agent/UDP]

$ns attach-agent $node_($source) $udp

set cbr [new Application/Traffic/CBR]

$cbr set packetSize_ 1024

$cbr set interval_ 0.1

$cbr attach-agent$udp

set null [new Agent/Null]

$ns attach-agent $node_($destination) $null

$ns connect $udp$null

$ns at 1.0 "$cbr start"

$ns at 1.0 "[$node_(intermediate router) agent 255] dump-table"

$ns at 20.0 "$cbr stop"


Screenshots