Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set ns [new Simulator]
- set f [open out.tr w]
- set nf [open output.nam w]
- $ns namtrace-all $nf
- $ns trace-all $f
- $ns color 1 Blue
- $ns color 2 Red
- proc finish { } {
- global ns f
- $ns flush-trace
- close $f
- exec nam output.nam &
- exit 0
- }
- set n0 [$ns node]
- set n1 [$ns node]
- set n2 [$ns node]
- set n3 [$ns node]
- set n4 [$ns node]
- set n5 [$ns node]
- set n6 [$ns node]
- $n0 color red
- $n1 color blue
- $n2 color green
- $n3 color yellow
- $n4 color cyan
- $n5 color magenta
- $n6 color orange
- $ns duplex-link $n0 $n1 1mb 10ms DropTail
- $ns duplex-link $n2 $n4 1mb 10ms DropTail
- $ns duplex-link $n3 $n5 1mb 10ms DropTail
- $ns simplex-link $n4 $n6 5mb 10ms DropTail
- $ns duplex-link $n0 $n6 1mb 10ms DropTail
- $ns duplex-link $n1 $n4 1mb 10ms DropTail
- $ns duplex-link $n0 $n5 1mb 10ms DropTail
- $ns duplex-link $n1 $n3 1mb 10ms DropTail
- $ns duplex-link $n2 $n6 1mb 10ms DropTail
- $ns at 5.0 "finish"
- $ns run
Add Comment
Please, Sign In to add comment