【NS2】新增mUDP、mUdpSink和mTcpSink模組
根據柯老師的《NS2模擬實驗——多媒體和無線網路通訊》一書可知,mUDP是UDP的延伸,除了具有UDP的功能外,還能記錄所傳送的包的資訊。mUdpSink可以把接收到的包的資訊記錄到檔案中。mTcpSink是TCPsink的延伸,除了具有TCPSink功能外,還能記錄所發出的包的資訊。
具體的新增步驟如下:
或直接下載measure資料夾:http://download.csdn.net/detail/joanna_yan/8232917
2.在 /ns-allinone-2.**/ns-2.** 目錄新建measure資料夾,把這四個檔案放入其中。
3.修改/ns-allinone-2.**/ns-2.**/common/packet.h,把如下程式加入struct hdr_cmn{}中。
int frametype_; //added by smallko
double sendtime_; // added by smallko
unsigned int pkt_id_; // added by smallko
unsigned int frame_pkt_id_; //added by smallko
4.分別在/ns-allinone-2.**/ns-2.**/Makefile和Makefile.in增加如下一行。
xcp/xcpq.o xcp/xcp.o xcp/xcp-end-sys.o \
measure/mtcpsink.o measure/mudp.o measure/mudpsink.o \ //此行為增加的
5.在/ns-allinone-2.**/ns-2.**/tcl/lib/ns-default.tcl增加如下一行。
Delayer set debug_ false
Agent/mUDP set packetSize_ 1000 //此行為增加的
6.在/ns-allinone-2.**/ns-2.**目錄下執行./configure;make clean;make命令,就OK了。