add initial docs for stream_socket_shutdown

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@227524 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2007-01-18 16:21:02 +00:00
parent 6520c3631a
commit 9ca324c96e
2 changed files with 140 additions and 1 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<!-- $Revision: 1.15 $ -->
<section id="stream.constants">
&reftitle.constants;
&extension.constants;
@ -277,6 +277,27 @@
for out-of-band data (TCP, for example).
</entry>
</row>
<row>
<entry><constant>STREAM_SHUT_RD</constant></entry>
<entry>
Used with <function>stream_socket_shutdown</function> to disable
further receptions. Added in PHP 5.2.1.
</entry>
</row>
<row>
<entry><constant>STREAM_SHUT_WR</constant></entry>
<entry>
Used with <function>stream_socket_shutdown</function> to disable
further transmissions. Added in PHP 5.2.1.
</entry>
</row>
<row>
<entry><constant>STREAM_SHUT_RDWR</constant></entry>
<entry>
Used with <function>stream_socket_shutdown</function> to disable
further receptions and transmissions. Added in PHP 5.2.1.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.stream-socket-shutdown">
<refnamediv>
<refname>stream_socket_shutdown</refname>
<refpurpose>Shutdown a full-duplex connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>stream_socket_shutdown</methodname>
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
<methodparam><type>int</type><parameter>how</parameter></methodparam>
</methodsynopsis>
<para>
Shutdowns (partially or not) a full-duplex connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stream</parameter></term>
<listitem>
<para>
An open stream (opened with <function>stream_socket_client</function>,
for example)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>how</parameter></term>
<listitem>
<para>
One of the following constants: <constant>STREAM_SHUT_RD</constant>
(disable further receptions), <constant>STREAM_SHUT_WR</constant>
(disable further transmissions) or
<constant>STREAM_SHUT_RDWR</constant> (disable further receptions and
transmissions).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>stream_socket_shutdown</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$server = stream_socket_server('tcp://127.0.0.1:1337');
$client = stream_socket_client('tcp://127.0.0.1:1337');
var_dump(fputs($client, "hello"));
stream_socket_shutdown($client, STREAM_SHUT_WR);
var_dump(fputs($client, "hello")); // doesn't work now
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
int(5)
Notice: fputs(): send of 5 bytes failed with errno=32 Broken pipe in test.php on line 9
int(0)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>fclose</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->