📄 opt.htm
字号:
<font face="Verdana" size="1">UDT_RCVBUF</font></td> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">int</font></td> <td width="323"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDT receiving buffer size limit</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">Default value is <font color="#008000">40960000</font> bytes.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDP_SNDBUF</font></td> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">int</font></td> <td width="323"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDP sending buffer size</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">Default value is <font color="#008000">65536</font> bytes.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDP_RCVBUF</font></td> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">int</font></td> <td width="323"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDP receiving buffer size</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">Default value is <font color="#008000">4194304</font> bytes.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">UDT_LINGER</font></td> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">linger</font></td> <td width="323"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">Linger time on close</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"> <font face="Verdana" size="1">Default value is <font color="#008000"> 1</font> second linger time.</font></td> </tr> <tr> <td width="133"> <font face="Verdana" size="1">UDT_RENDEZVOUS</font></td> <td width="133"> <font face="Verdana" size="1">bool</font></td> <td width="323"> <font face="Verdana" size="1">Use rendezvous connection setup method</font></td> <td width="812"> <font face="Verdana" size="1">Default value is false (no rendezvous setup).</font></td> </tr> <tr> <td width="133"> <font face="Verdana" size="1">UDT_SNDTIMEO</font></td> <td width="133"> <font face="Verdana" size="1">int</font></td> <td width="323"> <font face="Verdana" size="1">sending timeout value</font></td> <td width="812"> <font face="Verdana" size="1">Default value is -1 (infinite timeout).</font></td> </tr> <tr> <td width="133"> <font face="Verdana" size="1">UDT_RCVTIMEO</font></td> <td width="133"> <font face="Verdana" size="1">int</font></td> <td width="323"> <font face="Verdana" size="1">receiving timeout value</font></td> <td width="812"> <font face="Verdana" size="1">Default value is -1 (infinite timeout).</font></td> </tr> </table> <dt> </dt> <dt><font face="Verdana" size="2"><i>optval</i> </font></dt> <dd><font face="Verdana" size="2">[in (set), out (get)] The pointer to the value of UDT option of optName.</font></dd> <dt><font face="Verdana" size="2"><i>optlen </i></font></dt> <dd><font face="Verdana" size="2">[in (set), in/out (get)] The length of the <i>optval</i>. </font></dd></dl><h4><font face="Verdana" size="2">Return Values</font></h4><p><font face="Verdana" size="2">On success, 0 is returned; Otherwise, UDT::ERROR is returned and the specific error information can be retrieved by <a href="error.htm">getlasterror</a>.</font></p> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="table1" bordercolordark="#C0C0C0" bordercolorlight="#C0C0C0" width="100%"> <tr> <th align="center" bgcolor="#C0C0C0" width="133"> <font face="Verdana" size="2">Error Code</font></th> <th align="center" bgcolor="#C0C0C0" width="812"><b> <font face="Verdana" size="2">Comment</font></b></th> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> 5001</font></td> <td width="812"> <font face="Verdana" size="1"> the specific option cannot be set on a bound socket.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> 5002</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> the specific option cannot be set on a connected socket.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> 5003</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> the option value or option value length is invalid for setsockopt.</font></td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> 5004</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1"> <i>u</i> is an invalid UDT socket.</font></td> </tr> </table><h4><font face="Verdana" size="2">Description</font></h4><P><font face="Verdana" size="2">The <b>setsockopt</b> method sets the UDT option <i>optName</i> with the value of <i>optval</i>. The parameter of <i>optlen</i> is checked to verify the goodness of the option value. Not all options can be set at any state of UDT.</font></P><P><font face="Verdana" size="2">UDT_MSS can only be set before <b>bind</b>;UDT_CC and UDT_FC can only be set before the <b>listen</b> or <b>connect</b> call.</font></P><P><font face="Verdana" size="2">The <b>getsockopt</b> method reads the current option value. The value is written into the buffer pointed by <i>optval</i> and the length is returned in <i>optlen</i>.</font></P><H4><font face="Verdana" size="2">Examples</font></H4><P><font face="Verdana" size="2">To set data sending in non-blocking mode, the codes can be like:</font></P><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber2" bgcolor="#C0C0C0" bordercolor="#C0C0C0"> <tr> <td width="100%"> <p style="margin-top: 0; margin-bottom: 0"> <font size="1" face="Courier New">UDTSOCKET u;</font></p> <p style="margin-top: 0; margin-bottom: 0"> <font face="Courier New" size="1">...</font></p> <p style="margin-top: 0; margin-bottom: 0"> <font face="Courier New" size="1">bool block = false;</font></p> <p><font face="Courier New" size="1">UDT::setsockopt(u, 0, UDT_SNDSYN, &block, sizeof(bool));</font></td> </tr></table><H4><font face="Verdana" size="2">See Also</font></H4><P><b><font face="Verdana" size="2"><a href="t-config.htm">Configure UDT Options</a></font></b></P></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -