[問題] ns2 無線網路-有線網路 的問題

看板Network_Sim作者時間13年前 (2010/10/04 15:55), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
最近要改一個程式 也是從 柯老師的書上看到的範例 但改了好久 還是改不太好 所以看看有沒有厲害的大大可以教一下!!!!謝謝 原程式(部分) 資料流的方向從 W(0) 流到 MH(0) ----------> W(0)-----HA-----MH(0) W(0) 唯一個固定的 mode HA 為一個基地台 MH(0)唯一個mobile mode (移動點) #建立一個CBR的應用程式 (wired node ---> base station) set udp0 [new Agent/mUDP] $udp0 set_filename sd $udp0 set packetSize_ 1000 $ns_ attach-agent $W(0) $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $cbr0 set rate_ 500kb $cbr0 set packetSize_ 1000 set null0 [new Agent/mUdpSink] $null0 set_filename rd $MH(0) attach $null0 3 #當基地台收到cbr封包時,可以根據使用者設定以unicast或multicast轉送封包到mobile host set forwarder_ [$HA set forwarder_] puts [$forwarder_ port] $ns_ connect $udp0 $forwarder_ $forwarder_ dst-addr [AddrParams addr2id [$MH(0) node-addr]] $forwarder_ comm-type $comm_type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 我要改成 相反的方向流 資料流的方向從 MH(0) 流到 W(0) <----------- W(0)-----HA-----MH(0) 修改的部分!! #建立一個CBR的應用程式 (wired node ---> base station) set udp0 [new Agent/mUDP] $udp0 set_filename sd $udp0 set packetSize_ 1000 $ns_ attach-agent $MH(0) $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $cbr0 set rate_ 500kb $cbr0 set packetSize_ 1000 set null0 [new Agent/mUdpSink] $null0 set_filename rd $W(0) attach $null0 3 #當基地台收到cbr封包時,可以根據使用者設定以unicast或multicast轉送封包到mobile host set forwarder_ [$HA set forwarder_] puts [$forwarder_ port] $ns_ connect $udp0 $forwarder_ $forwarder_ dst-addr [AddrParams addr2id [$W(0) node-addr]] $forwarder_ comm-type $comm_type 但是 這樣改完之後 W(0) 收不到資料 不知道是否是哪邊觀念錯誤 麻煩會的大大告知 感激感激瞜 !!!! 改好久都改不出來 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.138.18.155 ※ 編輯: artist0408 來自: 140.138.18.155 (10/04 16:08)
文章代碼(AID): #1CgOY9Ux (Network_Sim)