simple-tcp.tcl

来自「跑leach需要的」· TCL 代码 · 共 39 行

TCL
39
字号
#Create a simulator objectset ns [new Simulator]#Open the ns trace fileset nf [open out.ns w]$ns trace-all $nfproc finish {} {        global ns nf        $ns flush-trace        close $nf        exit 0}#Create two nodesset n0 [$ns node]set n1 [$ns node]#Create a duplex link between the nodes$ns duplex-link $n0 $n1 1Mb 10ms DropTail#Create a TCP agent and attach it to node n0set tcp [new Agent/TCP/Reno]set snk [new Agent/TCPSink]$tcp set syn_ true$ns attach-agent $n0 $tcp$ns attach-agent $n1 $snk$ns connect $tcp $snk$ns at 0.5 "$tcp advanceby 1"$ns at 5.0 "finish"#Run the simulation$ns run

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?