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

📄 function.socket-set-nonblock.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Sets nonblocking mode for file descriptor fd</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.socket-set-block.html">socket_set_block</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.socket-set-option.html">socket_set_option</a></div> <div class="up"><a href="ref.sockets.html">Socket Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.socket-set-nonblock" class="refentry"> <div class="refnamediv">  <h1 class="refname">socket_set_nonblock</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5)</p><p class="refpurpose"><span class="refname">socket_set_nonblock</span> &mdash; <span class="dc-title">Sets nonblocking mode for file descriptor fd </span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">bool</span> <span class="methodname"><b><b>socket_set_nonblock</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$socket</tt></span>   )</div>  <p class="para rdfs-comment">   The <b>socket_set_nonblock()</b> function sets the    <b><tt>O_NONBLOCK</tt></b> flag on the socket specified by   the <i><tt class="parameter">socket</tt></i> parameter.  </p>  <p class="para">   When an operation (e.g. receive, send, connect, accept, ...) is performed on    a non-blocking socket, the script not pause its execution until it receives a    signal or it can perform the operation. Rather, if the operation would result   in a block, the called function will fail.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">socket</tt></i></span>     <dd>      <p class="para">       A valid socket resource created with <a href="function.socket-create.html" class="function">socket_create()</a>       or <a href="function.socket-accept.html" class="function">socket_accept()</a>.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>socket_set_nonblock()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">socket_create_listen</span><span style="color: #007700">(</span><span style="color: #0000BB">1223</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">socket_set_nonblock</span><span style="color: #007700">(</span><span style="color: #0000BB">$socket</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">socket_accept</span><span style="color: #007700">(</span><span style="color: #0000BB">$socket</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>     This example creates a listening socket on all interfaces on port 1223 and     sets the socket to <b><tt>O_NONBLOCK</tt></b> mode.      <a href="function.socket-accept.html" class="function">socket_accept()</a> will immediately fail unless there is a     pending connection exactly at this moment.    </p></div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.socket-set-block.html" class="function" rel="rdfs-seeAlso">socket_set_block()</a></li>    <li class="member"><a href="function.socket-set-option.html" class="function" rel="rdfs-seeAlso">socket_set_option()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.socket-set-block.html">socket_set_block</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.socket-set-option.html">socket_set_option</a></div> <div class="up"><a href="ref.sockets.html">Socket Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

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