📄 node362.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>30.1 UDP Agents</TITLE><META NAME="description" CONTENT="30.1 UDP Agents"><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="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html"><LINK REL="previous" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><LINK REL="up" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><LINK REL="next" HREF="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html6933" HREF="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html6927" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html6921" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html6929" 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="tex2html6931" 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="tex2html6934" HREF="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html">30.2 Commands at a</A><B> Up:</B> <A NAME="tex2html6928" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html">30. UDP Agents</A><B> Previous:</B> <A NAME="tex2html6922" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html">30. UDP Agents</A>   <B> <A NAME="tex2html6930" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html6932" 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="SECTION06110000000000000000"></A><A NAME="sec:udpagent"></A><BR>30.1 UDP Agents</H1>UDP agents are implemented in <TT>udp.{cc, h}</TT>. A UDP agent acceptsdata in variable size chunks from an application, and segments the data if needed. UDP packets also contain a monotonically increasing sequencenumber and an RTP timestamp. Although real UDP packets do not contain sequence numbers or timestamps, this sequence number does not incur any simulated overhead, and can be useful for tracefile analysis or forsimulating UDP-based applications.<P>The default maximum segment size (MSS) for UDP agents is 1000 byte:<PRE>Agent/UDP set packetSize_ 1000 # max segment size;</PRE>This OTcl instvar is bound to the C++ agent variable <TT>size_</TT>. <P>Applications can access UDP agents via the []sendmsg function in C++,or via the <TT>send</TT> or <TT>sendmsg</TT> methods in OTcl, as described insection <A HREF="node476.html#sec:systemcalls" tppabs="http://www.isi.edu/nsnam/ns/doc/node476.html#sec:systemcalls">35.2.3</A>. <P>The following is a simple example of how a UDP agent may be used in a program. In the example, the CBR traffic generator is started at time 1.0, at which timethe generator begins to periodically call the UDP agent []sendmsgfunction.<PRE> set ns [new Simulator] set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 5Mb 2ms DropTail set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $udp0 set packetSize_ 536 # set MSS to 536 bytes; set null0 [new Agent/Null] $ns attach-agent $n1 $null0 $ns connect $udp0 $null0 $ns at 1.0 "$cbr0 start"</PRE><P><HR><!--Navigation Panel--><A NAME="tex2html6933" HREF="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html6927" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html6921" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html6929" 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="tex2html6931" 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="tex2html6934" HREF="node363.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node363.html">30.2 Commands at a</A><B> Up:</B> <A NAME="tex2html6928" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html">30. UDP Agents</A><B> Previous:</B> <A NAME="tex2html6922" HREF="node361.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node361.html">30. UDP Agents</A>   <B> <A NAME="tex2html6930" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html6932" 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 + -