你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu Linux 9.10 安装NS2笔记

[日期:2009-12-23] 来源:blog.sina.com.cn/yangyang052328  作者:杨洋 [字体:大 中 小]
本以为NS已经装好,但是今天在运行一个例程时,出现了问题。运行的程序来自《NS2与网络模拟》第2章,example1.tcl:

set ns [new Simulator]

set tracef [open example1.tr w]
$ns trace-all $tracef
set namtf [open example1.nam w]
$ns namtrace-all $namtf

proc finish {} {
    global ns tracef namtf
    $ns flush-trace
    close $tracef
    close $namtf
    exec nam example1.nam &
    exit 0
}

set n0 [$ns node]
set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 10ms DropTail

set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0

set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0

set null0 [new Agent/Null]
$ns attach-agent $n1 $null0

$ns connect $udp0 $null0

$ns at 0.5 "$cbr0 start"
$ns at 4.5 "$cbr0 stop"

$ns at 5.0 "finish"
$ns runlinux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款