📄 node2.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>1. Introduction</TITLE><META NAME="description" CONTENT="1. Introduction"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html"><LINK REL="previous" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><LINK REL="up" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><LINK REL="next" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html1139" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html1133" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html1127" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html1135" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html1137" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html1140" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html">2. Undocumented Facilities</A><B> Up:</B> <A NAME="tex2html1134" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A><B> Previous:</B> <A NAME="tex2html1128" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A>   <B> <A NAME="tex2html1136" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html1138" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION01100000000000000000">1. Introduction</A></H1><P><BLOCKQUOTE>Let's start at the very beginning, <BR>a very nice place to start, <BR>when you sing, you begin with A, B, C, <BR>when you simulate, you begin with the topology,<A NAME="tex2html2" HREF="footnode.html#foot81" tppabs="http://www.isi.edu/nsnam/ns/doc/footnode.html#foot81"><SUP>1.1</SUP></A><BR>...</BLOCKQUOTE><P>This document (<I>ns Notes and Documentation</I>) provides reference documentation for ns.Although we begin with a simple simulation script, resources like Marc Greis's tutorial web pages (originally at his web site, now at <TT><A NAME="tex2html3" HREF="javascript:if(confirm('http://www.isi.edu/nsnam/ns/tutorial/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.isi.edu/nsnam/ns/tutorial/'" tppabs="http://www.isi.edu/nsnam/ns/tutorial/">http://www.isi.edu/nsnam/ns/tutorial/</A></TT>) or the slides from one of the ns tutorials are problably better places to begin for the ns novice.<P>We first begin by showing a simple simulation script.This script is also available in the sources intcl/ex/simple.tcl.<P>This script defines a simple topology of four nodes,and two agents, a UDP agent with a CBR traffic generator, and a TCP agent.The simulation runs for . The output is two trace files,<TT>out.tr</TT> and <TT>out.nam</TT>.When the simulation completes at the end of ,it will attempt to run a nam visualisation of the simulation on yourscreen.<P><PRE># The preambleset ns [new Simulator] # initialise the simulation;# Predefine tracingset f [open out.tr w]$ns trace-all $fset nf [open out.nam w]$ns namtrace-all $nf\clearpage# so, we lied. now, we define the topology## n0# \bs# 5Mb \bs# 2ms \bs# \bs# n2 --------- n3# / 1.5Mb# 5Mb / 10ms# 2ms /# /# n1#set n0 [$ns node]set n1 [$ns node]set n2 [$ns node]set n3 [$ns node]$ns duplex-link $n0 $n2 5Mb 2ms DropTail$ns duplex-link $n1 $n2 5Mb 2ms DropTail$ns duplex-link $n2 $n3 1.5Mb 10ms DropTail# Some agents.set udp0 [new Agent/UDP] # A UDP agent;$ns attach-agent $n0 $udp0 # on node $n0;set cbr0 [new Application/Traffic/CBR] # A CBR traffic generator agent;$cbr0 attach-agent $udp0 # attached to the UDP agent;$udp0 set class_ 0 # actually, the default, but\ldots;set null0 [new Agent/Null] # Its sink;$ns attach-agent $n3 $null0 # on node $n3;$ns connect $udp0 $null0$ns at 1.0 "$cbr0 start"puts [$cbr0 set packetSize_]puts [$cbr0 set interval_]# A FTP over TCP/Tahoe from $n1 to $n3, flowid 2set tcp [new Agent/TCP]$tcp set class_ 1$ns attach-agent $n1 $tcpset sink [new Agent/TCPSink]$ns attach-agent $n3 $sinkset ftp [new Application/FTP] # TCP does not generate its own traffic;$ftp attach-agent $tcp$ns at 1.2 "$ftp start"$ns connect $tcp $sink$ns at 1.35 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"\clearpage# The simulation runs for \(3s\).# The simulation comes to an end when the scheduler invokes the finish{} procedure below.# This procedure closes all trace files, and invokes nam visualization on one of the trace files.$ns at 3.0 "finish"proc finish {} { global ns f nf $ns flush-trace close $f close $nf puts "running nam..." exec nam out.nam & exit 0}# Finally, start the simulation.$ns run</PRE><P><HR><!--Navigation Panel--><A NAME="tex2html1139" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html1133" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html1127" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html1135" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html1137" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html1140" HREF="node3.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node3.html">2. Undocumented Facilities</A><B> Up:</B> <A NAME="tex2html1134" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A><B> Previous:</B> <A NAME="tex2html1128" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A>   <B> <A NAME="tex2html1136" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html1138" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -