IV. Set up a ns-2 simulation with co-existing TCP and UDP Multicast Traffic:
# Creating the core event scheduler ...FILL IN... $ns color 1 red $ns color 2 blue # Creating 11 nodes ...FILL IN... # Outputs nam traces set nf [open out.nam w] $ns namtrace-all $nf # Creating 10 links # All with bandwidth 10Mb, delay 10ms, and DropTail queue # Except the bottleneck link with bw 1.5Mb, delay 20ms, and RED queue ...FILL IN... # Set queue limit (buffer size) to 5 packets in the bottleneck link $ns queue-limit $n(3) $n(4) ...FILL IN... $ns queue-limit $n(4) $n(3) ...FILL IN... # Set link orientation for nam $ns duplex-link-op $n(0) $n(3) orient right-down $ns duplex-link-op $n(1) $n(3) orient right $ns duplex-link-op $n(2) $n(3) orient right-up $ns duplex-link-op $n(3) $n(4) orient right $ns duplex-link-op $n(4) $n(5) orient right-up $ns duplex-link-op $n(4) $n(6) orient right-down $ns duplex-link-op $n(5) $n(7) orient right-up $ns duplex-link-op $n(5) $n(8) orient right $ns duplex-link-op $n(6) $n(9) orient right $ns duplex-link-op $n(6) $n(10) orient right-down # Set queue position for nam $ns duplex-link-op $n(3) $n(4) queuePos -0.5 $ns duplex-link-op $n(4) $n(3) queuePos -0.5 # Set multicast routing to dense mode ...FILL IN... # Create a TCP connection from node 9 to node 1 ...FILL IN... $tcp set class_ 1 $tcp set window_ 20 # Create an FTP source and attach it to the TCP connection ...FILL IN... # Create a UDP connection from node 7 to a multicast group ...FILL IN... $udp set class_ 2 # Create a CBR source and attach it to the UDP connection ...FILL IN... # Create dummy receivers and attach them to the receiving nodes set rcvr0 [new Agent/Null] $ns attach-agent $n(0) $rcvr0 set rcvr1 [new Agent/Null] $ns attach-agent $n(2) $rcvr1 # Schedule events to happen ...FILL IN... # A finish proc to flush traces and out call nam proc finish {} { global ns nf $ns flush-trace close $nf puts "running nam..." exec nam out.nam & exit 0 } # Start the event scheduler $ns runprompt> ns lab4.tcl
References: