1: #NS2_有线部分\homework01.tcl
  2:
  3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析
  4: #tcp上层用ftp
  5: #udp上层用cbr
  6: #Create a simulator object
  7: set ns [new Simulator]
  8:
  9: set nf [open SZ2BJ.nam w]
 10: $ns namtrace-all $nf
 11:
 12: set nd [open SZ2BJ.tr w]
 13: $ns namtrace-all $nd
 14:
 15: proc finish {} {
 16:     global ns nf nd
 17:     $ns flush-trace
 18:     close $nf
 19:     close $nd
 20:     exec nam SZ2BJ.nam &
 21:     exit 0
 22: }
 23:
 24:
 25: #$ns node-config     -addressType    hierarchical
 26:
 27: #Create two nodes
 28: set Node_Shenzhen [$ns node]
 29: $Node_Shenzhen color red
 30: $Node_Shenzhen shape hexagon
 31: #$Node_Shenzhen label "ShenZhen"
 32:
 33: set Node_Beijing  [$ns node]
 34: $Node_Beijing color red
 35: #$Node_Beijing lable "BeiJing"
 36: #Create a duplex link between the nodes
 37: $ns duplex-link $Node_Shenzhen $Node_Beijing 1Mb 500ms DropTail
 38:
 39: #$ns queue-limit $2 $n3 10
 40:
 41: #TCP
 42: set Agent_Sender [new Agent/TCP]
 43: $Agent_Sender set class_    2
 44: $Agent_Sender set addr_     192.168.1.100
 45: $Agent_Sender set dst_addr- 192.168.1.200
 46: $Agent_Sender set size_     1492
 47: $Agent_Sender set defttl_   256
 48: $ns attach-agent $Node_Shenzhen $Agent_Sender
 49:
 50: set Agent_Receiver [new Agent/NULL]
 51: $ns attach-agent $Node_Beijing $Agent_Receiver
 52:
 53: $ns connect $Agent_Sender $Agent_Receiver
 54:
 55: #Simulated Application
 56: set App_Ftp [new Application/FTP]
 57: $App_Ftp attach-agent $Agent_Sender
 58:
 59:
 60: #start and stop FTP
 61: $ns at 1.0 "App_Ftp start"
 62: $ns at 4.0 "App_Ftp stop"
 63:
 64: $ns at 5.0 "finish"
 65:
 66: $ns run
 67: 

NS2网络模拟(5)-homework01.tcl的更多相关文章

  1. NS2网络模拟(7)-homework03.tcl

    1: #NS2_有线部分\homework03.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...

  2. NS2网络模拟(6)-homework02.tcl

    1: #NS2_有线部分\homework02.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...

  3. NS2网络模拟(4)-吞吐率图

    1: #NS2_有线部分\ForGnuplot.plot 2: 3: #gnuplot> 4: #set xtics 0, 1, 10 5: set grid 6: set xrange [0: ...

  4. NS2网络模拟(3)-吞吐率

    1: #NS2_有线部分\Throughput.awk 2: 3: BEGIN { 4: #Initialize the variable 5: init = 0; 6: i = 0; 7: } 8: ...

  5. NS2网络模拟(2)-丢包率

    1: #NS2_有线部分\LossRate.awk 2: 3: BEGIN { 4: #Initialize the variable 5: Lost = 0; #the Sum of Lost pa ...

  6. NS2网络模拟(1)-延迟

    1: #NS2_有线部分\EndDelay.awk 2: 3: BEGIN { 4: #Initialize the variable 5: MaxID = 0; 6: i = 0; 7: } 8: ...

  7. ns2的第一个tcl脚本

    set ns [new Simulator] set tracef [open example1.tr w]$ns trace-all $tracefset namtf [open example1. ...

  8. 【NS2】WiMAX_NS2说明文档(转载)

    关于目前NS2中WiMAX模块的说明 (1)美国NIST(National Institute of Standards and Technology)版, 可以从NIST主页获得,2007.04 r ...

  9. 【NS2】ubuntu安装和同时使用不同版本的ns2(转载)

    有时候我们可能会遇到要同时安装两个ns版本的问题,比如我研究wimax/802.16,因为协议太复杂,用的是长庚大学和nist的wimax补丁.长庚大学的wimax补丁是在ns2.29下开发的,nis ...

随机推荐

  1. [Docker] Run, Stop and Remove Docker Containers

    In this lesson, we'll find out the basics of running Docker containers. We'll go over how to downloa ...

  2. 【53.61%】【BZOJ 2302】[HAOI2011]Problem c

    Time Limit: 30 Sec Memory Limit: 256 MB Submit: 526 Solved: 282 [Submit][Status][Discuss] Descriptio ...

  3. Spring之i18n配置与使用

    Spring的i18n配置: <!-- conf:i18n --> <bean id="messageSource" class="org.spring ...

  4. try~Catch语句中异常的处理过程

    [2014/10/12 21:40]文章待续~ 1.函数自身捕获处理异常的情况 以下的样例介绍了try~catch语句中出现异常时语句的运行顺序: package month10; import ja ...

  5. phpStudy的localhost不能访问怎么解决(相关性)

    phpStudy的localhost不能访问怎么解决(相关性) 一.总结 1.注释掉httpd.conf文件中的#ServerName localhost:80   这句话. 2.既然是localho ...

  6. JS表格分页组件:fupage的设计思路和具体用法(未来考虑开源,争取在2015年)

    一.背景         之前在秒针工作的时候,某js高级工程师写了很多自己的组件,其中一套是分页组件,叫做st-grid.不过在我看来,bug太多,我经常给他反馈bug,我也不清楚为啥别人没有发现. ...

  7. [Ramda] Get Deeply Nested Properties Safely with Ramda's path and pathOr Functions

    In this lesson we'll see how Ramda's path and pathOr functions can be used to safely access a deeply ...

  8. ZOJ 3209 Treasure Map DLX

    用最少的矩阵覆盖n*m的地图.注意矩阵不能互相覆盖. 这里显然是一个精确覆盖,但因为矩阵拼接过程中,有公共的边,这里须要的技巧就是把矩阵的左边和以下截去一个单位. #include <stdio ...

  9. CSU1323: ZZY and his little friends

    Description zzy养了一只小怪兽和N只凹凸曼,单挑的话每只凹凸曼都不是小怪兽的对手,所以必须由两只凹凸曼合作来和小怪兽战斗.凹凸曼A和凹凸曼B合作的战斗力为他们战斗力的异或值.现在由zzy ...

  10. 理解Erlang/OTP Supervisor

    http://www.cnblogs.com/me-sa/archive/2012/01/10/erlang0030.html Supervisors are used to build an hie ...