| Index: net/third_party/udt/doc/doc/select.htm
|
| ===================================================================
|
| --- net/third_party/udt/doc/doc/select.htm (revision 78992)
|
| +++ net/third_party/udt/doc/doc/select.htm (working copy)
|
| @@ -1,106 +0,0 @@
|
| -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| -<html xmlns="http://www.w3.org/1999/xhtml">
|
| -<head>
|
| -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
| -<title> UDT Reference</title>
|
| -<link rel="stylesheet" href="udtdoc.css" type="text/css" />
|
| -</head>
|
| -
|
| -<body>
|
| -<div class="ref_head"> UDT Reference: Functions</div>
|
| -
|
| -<h4 class="func_name"><strong>select</strong></h4>
|
| -<p>The <b>select</b> method queries one or more groups of UDT sockets.</p>
|
| -
|
| -<div class="code">int select(<br />
|
| - int <font color="#FFFFFF">nfds</font>,<br />
|
| - UDSET* <font color="#FFFFFF">readfds</font>,<br />
|
| - UDSET* <font color="#FFFFFF">writefds</font>,<br />
|
| - UDSET* <font color="#FFFFFF">exceptfds</font>,<br />
|
| - const struct timeval* <font color="#FFFFFF">timeout</font><br />
|
| -);</div>
|
| -
|
| -<h5>Parameters</h5>
|
| -<dl>
|
| - <dt><i>nfds</i></dt>
|
| - <dd>[in] Ignored. For compatibility only.</dd>
|
| - <dt><em>readfds</em></dt>
|
| - <dd>[in, out] Optional pointer to a set of sockets to be checked for readability.</dd>
|
| - <dt><em>writefds</em></dt>
|
| - <dd>[in, out] Optional pointer to a set of sockets to be checked for writability.</dd>
|
| - <dt><em>exceptfds</em></dt>
|
| - <dd>[in, out] Ignored. For compatibility only.</dd>
|
| - <dt><em>timeout</em></dt>
|
| - <dd>[in] The future time when this call should be timeout.</dd>
|
| -</dl>
|
| -
|
| -<h5>Return Value</h5>
|
| -<p>If any of the read or write query is positive, <strong>select</strong> returns the number of UDT sockets that are read for read/write. If no socket is ready before timeout, zero is
|
| -returned. If there is any error, UDT::ERROR is returned and the specific error information can be retrieved using <a href="error.htm">getlasterror</a>. The <i>readfds</i> and/or
|
| -<i>writefds</i> will be updated to contain the ready sockets only.</p>
|
| -
|
| -
|
| -<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
|
| - <tr>
|
| - <td width="17%" class="table_headline"><strong>Error Name</strong></td>
|
| - <td width="17%" class="table_headline"><strong>Error Code</strong></td>
|
| - <td width="83%" class="table_headline"><strong>Comment</strong></td>
|
| - </tr>
|
| - <tr>
|
| - <td>EINVPARAM</td>
|
| - <td>5003</td>
|
| - <td>All three socket sets are empty or at least one of the socket is invalid.</td>
|
| - </tr>
|
| -</table>
|
| -
|
| -<h5>Description</h5>
|
| -<p>The UDSET is a structure to store the UDT socket descriptors. If should only be processed with the following macros.</p>
|
| -<dl>
|
| - <dt><b>UD_CLR</b>(<i>u, *set</i>)</dt>
|
| - <dd>Removes the descriptor <i>u</i> from <i>set</i>.</dd>
|
| - <dt><b>UD_ISSET</b>(<i>u, *set</i>)</dt>
|
| - <dd>Nonzero if <i>u</i> is a member of <i>set</i>; otherwise zero.</dd>
|
| - <dt><b>UD_SET</b>(<i>u, *set</i>)</dt>
|
| - <dd>Add descriptor <i>u</i> to <i>set</i>.</dd>
|
| - <dt><b>UD_ZERO</b>(<i>*set</i>)</dt>
|
| - <dd>Initialize <i>set</i> to an empty set.</dd>
|
| -</dl>
|
| -
|
| -<p>The UDT descriptors sets originaly contains the sockets whose status is to be queried. When <strong>select</strong> returns, the descriptors sets only contain the sockets that are
|
| -ready for IO. UD_ISSET can be used to check which one is ready.</p>
|
| -<p><i>readfds</i> is used to detect if any socket in this set is available for reading (recv, recvmsg), for accepting a new connection (accept), or the associated connection is broken.
|
| -<i>writefds</i> is used to detect if any socket in this set has available buffer for sending (send, sendmsg). Currently <i>exceptfds</i> is not used.</p>
|
| -
|
| -<h5>Example</h5>
|
| -<p>The following example shows how to check if a UDT socket is available for <strong>recv</strong>.</p>
|
| -
|
| -<div class="code">
|
| -<p>
|
| -UDTSOCKET u;<br>
|
| -...<br>
|
| -<br>
|
| -timeval tv;<br>
|
| -UDSET readfds;<br>
|
| -<br>
|
| -tv.tv_sec = 1;<br>
|
| -tv.tv_usec = 0;<br>
|
| -<br>
|
| -UD_ZERO(&readfds);<br>
|
| -UD_SET(u, &readfds);<br>
|
| -<br>
|
| -int res = UDT::select(0, &readfds, NULL, NULL, &tv);<br>
|
| -<br>
|
| -if ((res != UDT::ERROR) && (UD_ISSET(u, &readfds)))<br>
|
| - // read data from u.<br>
|
| -else<br>
|
| - // timeout or error<br>
|
| -</p>
|
| -</div>
|
| -
|
| -
|
| -<h5>See Also</h5>
|
| -<p><strong><a href="selectex.htm">selectEx</a><a href="opt.htm"></a></strong></p>
|
| -<p> </p>
|
| -
|
| -</body>
|
| -</html>
|
|
|