⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accept.htm

📁 udt的一个源代码
💻 HTM
字号:
<html><head><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>UDT Reference</title></head><body><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1" bgcolor="#99CCFF" bordercolor="#99CCFF">  <tr>    <td width="100%"><font face="Verdana" size="2"><i>&nbsp;UDT Reference: UDT 	Functions</i></font></td>  </tr></table><h1><font face="Verdana" size="4">accept</font></h1><p><font face="Verdana" size="2">The <b>accept</b> method retrieves an incoming connection.</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 accept(<br>&nbsp; UDTSOCKET <font color="#FFFFFF">u</font>,<br>&nbsp; struct sockaddr* <font color="#FFFFFF"> <a class="synParam" onclick="showTip(this)">addr</a></font>,<br>&nbsp; int* <font color="#FFFFFF"> <a class="synParam" onclick="showTip(this)">addrlen</a></font><br>	);</font></p></td>  </tr></table><h4><font face="Verdana" size="2">Parameters</font></h4><dl>	<dt><font face="Verdana"><i><font size="2">u</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[in] Descriptor identifying a listening 	socket. </font></dd>	<dt><font face="Verdana"><i><font size="2">addr</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[out] Address of the peer side of the new 	accepted connection. </font></dd>	<dt><font face="Verdana"><i><font size="2">addrlen</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[out] Length of the <i>addr</i> structure. </font> </dd></dl><h4><font face="Verdana" size="2">Return Values</font></h4><p><font face="Verdana" size="2">If no error occurs, <b>accept</b> returns the UDT socket descriptor of the new connection; otherwise, it returnsUDT::INVALID_SOCK. </font></p><p><font face="Verdana" size="2">On a successful return, the address of the peer side of the connection is written into <i>addr</i>, and its length is in <i>addrlen</i>, if the <i>addr</i> parameter is not NULL.</font></p><p><font face="Verdana" size="2">If an error is returned, the error information can be retrieved by <a href="error.htm">getlasterror</a>. One of the following error can cause an <b>accept</b> error:</font></p>  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="table2" 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">		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>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		5006</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		<i>u</i> 		is not in the listening state.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">        5007</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		<i>u</i> 		is set up to support rendezvous connection.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		6002</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		<i>u</i> 		is non-blocking (UDT_RCVSYN = false) but there is no connection 		available.</font></td>    </tr>    </table><H4><font face="Verdana" size="2">Descriptions</font></H4><p><font face="Verdana" size="2">Once a UDT socket is in listening state, it accepts new connections and maintains the pending connections in a queue. An <b>accept</b> call retrieves the first connection in the queue, removes it from the queue, and returns the associate socket descriptor. </font></p><p><font face="Verdana" size="2">If there is no connections in the queue when <b>accept</b> is called, a blocking socket will wait until a new connection is set up, whereas a non-blocking socket will return immediately with an error.</font></p><p><font face="Verdana" size="2">The accepted sockets will inherit all proper attributes from the listening socket.</font></p><H4><font face="Verdana" size="2">See Also</font></H4><P><font face="Verdana" size="2"><b><a href="listen.htm">listen</a>, <a href="connect.htm">connect</a>,</b> <b><a href="opt.htm">setsockopt</a></b>,<b><a href="opt.htm">getsockopt</a></b></font></P></body></html>

⌨️ 快捷键说明

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