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. 【BZOJ 3675】[Apio2014]序列分割

    [链接] 链接 [题意] 在这里输入题意 [题解] 模拟一下样例. 会发现.切的顺序不影响最后的答案. 只要切点确定了. 答案就确定了. 则设f[i][j]表示前i段,第i段保留到j的最大值. \(f ...

  2. 【5001】n皇后问题

    Time Limit: 10 second Memory Limit: 2 MB 在n*n的棋盘上放置n个皇后(国际象棋中的皇后,n≤10)而彼此不受攻击(即在棋盘的任一行,任一列和任一对角线上不能放 ...

  3. 调试 之gdb thread命令 与 ltrace/strace

    我们可以通过  1)  gdb prog_name -> r               用在逐步调试自己的程序时 2)  gdb -> attach process_id       正 ...

  4. stm32的dac

  5. 【34.57%】【codeforces 557D】Vitaly and Cycle

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  6. ios开发runtime学习五:KVC以及KVO,利用runtime实现字典转模型

    一:KVC和KVO的学习 #import "StatusItem.h" /* 1:总结:KVC赋值:1:setValuesForKeysWithDictionary实现原理:遍历字 ...

  7. 卸载、指定卸载 .NET Core Runtime and SDK

    原文:卸载.指定卸载 .NET Core Runtime and SDK 项目使用的 Nuget 包,比如 Microsoft.AspNetCore.App等的版本号要与 .NET Core 版本号( ...

  8. [Angular] Auxiliary named router outlets

    Define a auxilliary router: export const ROUTES: Routes = [ { path: 'folder/:name', component: MailF ...

  9. Kinect舒适区范围--UE4 的Blueprint测试范例

    本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接: http://blog.csdn.net/cartzhang/article/details/44748475 作者:ca ...

  10. ArcSDE中Compress与Compact的区别

    原文 ArcSDE中Compress与Compact的区别 附件一”为两种数据库需要的管理工作.      与所表示的含义与操作是不同的.     对于来说,Compressing与Smart Dat ...