日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

set class_ x set fid_ x

發布時間:2025/4/16 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 set class_ x set fid_ x 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
關于 set class_ x?, set fid_ x? 網絡上有一些解釋。 http://blog.csdn.net/wanghui_one/archive/2009/03/12/3985331.aspx http://www.baisi.net/thread-3005681-1-32.html http://www.baisi.net/thread-31289-1-4.html 主要意思是 set class_ x跟nam中顏色設置有關,而set fid_ x是標注網絡流ID,跟著色無關。經在windows XP + cygwin + ns2.29下測試,set fid_ x 在nam中著色的優先級比set class_ x高。具體見后面的例子。 #Create a simulator object set ns [new Simulator]#Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red#Open the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf#Define a 'finish' procedure proc finish {} {global ns nf$ns flush-trace#Close the NAM trace fileclose $nf#Execute NAM on the trace fileexec nam out.nam &exit 0 }#Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node]#Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail#Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 10#Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right#Monitor the queue for link (n2-n3). (for NAM) $ns duplex-link-op $n2 $n3 queuePos 0.5#Setup a TCP connection set tcp [new Agent/TCP] $tcp set class_ 2 $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n3 $sink $ns connect $tcp $sink $tcp set fid_ 1#Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP#Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n3 $null $ns connect $udp $null $udp set fid_ 2#Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 1mb $cbr set random_ false#Schedule events for the CBR and FTP agents $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at 4.0 "$ftp stop" $ns at 4.5 "$cbr stop"#Detach tcp and sink agents (not really necessary) $ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"#Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish"#Print CBR packet size and interval puts "CBR packet size = [$cbr set packet_size_]" puts "CBR interval = [$cbr set interval_]"#Run the simulation $ns run 此例中只要改變 set fid_ x 中 'x'的值,在nam中對應網絡流的顏色必改變。而改變set class_ x 中 'x'的值,顏色不改變。當把set fid_ x 語句都注釋掉后,再把set class_ x 中的 'x' 值改為對應的顏色值,顏色隨之改變。再把set class_ x 都注釋掉,顏色都為黑色。

?

?

?

?

?

總結

以上是生活随笔為你收集整理的set class_ x set fid_ x的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。