mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
116 lines
5.3 KiB
HTML
116 lines
5.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Shutdown a full-duplex connection</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.stream-socket-shutdown" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">stream_socket_shutdown</h1>
|
||
<p class="verinfo">(PHP 5 >= 5.2.1, PHP 7)</p><p class="refpurpose"><span class="refname">stream_socket_shutdown</span> — <span class="dc-title">Shutdown a full-duplex connection</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.stream-socket-shutdown-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>stream_socket_shutdown</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stream</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$how</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
Shutdowns (partially or not) a full-duplex connection.
|
||
</p>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
The associated buffer, or buffers, may or may not be emptied.
|
||
</p>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.stream-socket-shutdown-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">stream</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
An open stream (opened with <span class="function"><a href="stream_socket_client.html" class="function">stream_socket_client()</a></span>,
|
||
for example)
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">how</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
One of the following constants: <strong><code>STREAM_SHUT_RD</code></strong>
|
||
(disable further receptions), <strong><code>STREAM_SHUT_WR</code></strong>
|
||
(disable further transmissions) or
|
||
<strong><code>STREAM_SHUT_RDWR</code></strong> (disable further receptions and
|
||
transmissions).
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.stream-socket-shutdown-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.stream-socket-shutdown-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="stream-notification-callback.example.download">
|
||
<p><strong>Example #1 A <span class="function"><strong>stream_socket_shutdown()</strong></span> example</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /><br />$server </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_socket_server</span><span style="color: #007700">(</span><span style="color: #DD0000">'tcp://127.0.0.1:1337'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_socket_client</span><span style="color: #007700">(</span><span style="color: #DD0000">'tcp://127.0.0.1:1337'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">fputs</span><span style="color: #007700">(</span><span style="color: #0000BB">$client</span><span style="color: #007700">, </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">stream_socket_shutdown</span><span style="color: #007700">(</span><span style="color: #0000BB">$client</span><span style="color: #007700">, </span><span style="color: #0000BB">STREAM_SHUT_WR</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">fputs</span><span style="color: #007700">(</span><span style="color: #0000BB">$client</span><span style="color: #007700">, </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">)); </span><span style="color: #FF8000">// doesn't work now<br /><br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程的输出类似于:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
int(5)
|
||
|
||
Notice: fputs(): send of 5 bytes failed with errno=32 Broken pipe in test.php on line 9
|
||
int(0)
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.stream-socket-shutdown-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="fclose.html" class="function" rel="rdfs-seeAlso">fclose()</a> - 关闭一个已打开的文件指针</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |