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. sqlplus中怎么将你全部的操作和结果记录保存到你指定的文件里

    [在sqlplus的操作中,非常多时候我们都想把自己的写的sql语句和改动日志或者结果信息做记录] [首先]肯定要正常连接到oralce数据库. [然后] 你用你指定的用户登录到oralce数据库之后 ...

  2. 使用C#版本的gdal库打开hdf文件

    作者:朱金灿 来源:http://blog.csdn.net/clever101 最近应同事的请求帮忙研究下使用C#版的gdal库读取hdf文件,今天算是有一点成果,特地做一些记录. 首先是编译C#版 ...

  3. ImageButton按压效果失效

    LinearLayout中ImageButton的按压效果不起作用,如图 布局如下: <LinearLayout android:id="@id/ll_add_reply_face&q ...

  4. URL validation failed. The error could have been caused through the use of the browser&#39;s navigation

    URL validation failed. The error could have been caused through the use of the browser's navigation ...

  5. ios开发网络学习四:NSURLConnection大文件断点下载

    #import "ViewController.h" @interface ViewController ()<NSURLConnectionDataDelegate> ...

  6. hibernate级联保存问题

    异常:org.hibernate.TransientObjectException: object references an unsaved transient instance 解决方法: XML ...

  7. Ubuntu snmp配置

    http://wenku.baidu.com/link?url=7ieAta_w87NDrTOT_DyEQSj4Rd9i82YRUGQl--g077oC3ftckgH7wpT5QEyir-NtZLA3 ...

  8. Android开发和測试实践 - 接入友盟统计

    这两年一直在做无线的測试,兴许还会继续去做无线的測试,可是之前由于时间的原因一直都没有非常细致的了解到代码层面. 最近抽出时间自己做了些app的开发,决定假设想把移动的測试做好做深入.有一定的app开 ...

  9. Android 设置alpha值来制作透明与渐变效果的实例

    Android系统支持的颜色是由4个值组成的,前3个为RGB,也就是我们常说的三原色(红.绿.蓝),最后一个值是A,也就是Alpha.这4个值都在0~255之间.颜色值越小,表示该颜色越淡,颜色值越大 ...

  10. C# Tuple VS ValueTuple

    C# Tuple VS ValueTuple(元组类 VS 值元组) C# 7.0已经出来一段时间了,大家都知道新特性里面有个对元组的优化:ValueTuple.这里利用详尽的例子详解Tuple VS ...