`
searun
  • 浏览: 174033 次
  • 性别: Icon_minigender_1
  • 来自: 合肥
社区版块
存档分类
最新评论

NS2中RTP的简单应用

    博客分类:
  • NS
阅读更多

NS2已经支持简单的RTP应用了,但是很多人却不知道如何使用。这其中一个主要的原因就是NS2的发行版中自带的RTP示例并不能够正常运行。这个问题好几年前就已经有人提了出来,可是很奇怪的是,一直到现在都没有修改掉,而且还有很多人在不同的论坛上提出同样的问题。没有办法,只有自己动手,丰衣足食。

在安装目录的tcl/ex文件夹下有个simple-rtp.tcl文件,演示了RTP协议的简单应用。但是如果直接运行的话,则可能出现厦门的错误提示:

$ ns simple-rtp.tcl
warning: no class variable Session/RTP::debug_
          see tcl-object.tcl in tclcl for info about this warning.
  warning: no class variable Session/RTP::debug_
          see tcl-object.tcl in tclcl for info about this warning.
  warning: no class variable Session/RTP::debug_
          see tcl-object.tcl in tclcl for info about this warning.
  warning: no class variable Session/RTP::debug_
          see tcl-object.tcl in tclcl for info about this warning.
  Warning dst_ is no longer being supported in NS. dst_ -2147483648
Use dst_addr_ and dst_port_ instead 

 这里的提示给出了两个信息,一个是没有类变量Session/RTP::debug_,第二个信息变量使用错误。首先解决第一个问题,在tcl/lib/ns-default.tcl中添加下面一行代码:

Session/RTP set debug_ 0

 这里的意思表示默认将调试功能关闭。当然如果需要调试功能的时候,可以在TCL脚本中将此值设置为1或者“ON”。

第二个问题是在tcl/rtp/session-rtp.tcl文件中修改join-group函数,修改代码如下:

Session/RTP instproc join-group { g } {
	 set g [expr $g]
	 $self set group_ $g
	 mvar node_ dchan_ cchan_ 
	 $dchan_ set dst_addr_ $g
	 $node_ join-group $dchan_ $g
	 incr g
	 $cchan_ set dst_addr $g
	 $node_ join-group $cchan_ $g
}

 最后要注意的是,必须重新编译NS2 ,修改的代码才会起作用。

重新编译后,再运行这个simple-rtp.tcl文件就没有问题了。

上一个NAM模拟运行的图:



 从图中并没有看出有什么不同的地方,因为这里传输的都是数据(黑色)。当然这里只是一个演示,具体的分析信息还是要看Trace文件,可以看到其它类型的报文信息。

 

BTW: 由于是在Windows下使用Cygwin编译的NS2,所以为了使用NAM,装了X,可是在运行的时候却出现了下面的错误信息:

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
(II) XF86Config is not supported
(II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
winAdjustVideoModeShadowGDI - Using Windows display depth of 32 bits per pixel
winAllocateFBShadowGDI - Creating DIB with width: 1280 height: 800 depth: 32
......
XFree86-Bigfont extension local-client optimization disabled due to lack of shared memory support in the kernel
(--) Setting autorepeat to delay=500, rate=31
(--) winConfigKeyboard - Layout: "00000804" (00000804) 
(EE) Keyboardlayout "中文 (简体) - 美式键盘" (00000804) is unknown
(--) 3 mouse buttons found
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
winInitMultiWindowWM - pthread_mutex_lock () returned.
winProcEstablishConnection - Hello
......

 重新安装Cygwin没有解决这个问题,在网上搜索也没有找到解决方案。无意中打开了Xming,结果在启动X失败后,Xming打开了X窗口。现在也没有心思去琢磨背后是什么原因引起的,如果有谁知道的话,麻烦告知一声。

  • 大小: 7.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics