statment like tcp but i can't can you help me
#Create a simulator object
set ns [new Simulator -multicast on]
# Dense Mode Multicast Protocol
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
# all nodes will contain multicast protocol agents;
set mrthandle [$ns mrtproto $mproto]
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit 0
}
#create 4 node
for {set i 0} {$i < 4} {incr i} {
set n($i) [$ns node]
}
set tcpsrc [new Agent/TCP]
$ns attach-agent $n(0) $tcpsrc
#TCP Sources, destinations, connections
for {set i 1} {$i <= 3} { incr i } {
set tcp_snk($i) [new Agent/TCPSink]
$ns attach-agent $n($i) $tcp_snk($i)
$ns connect $tcpsrc $tcp_snk($i)
set ftp($i) [$tcpsrc attach-source FTP]
}
$ns duplex-link $n(0) $n(1) 1Mb 10ms DropTail
$ns duplex-link $n(0) $n(2) 1Mb 10ms DropTail
$ns duplex-link $n(0) $n(3) 1Mb 10ms DropTail
$ns at 10.0 "finish"
#Run the simulation
$ns run
No comments:
Post a Comment