php-doc-en/reference/sockets/functions/socket-set-block.xml
Derek Ford 2d27832cb7 Fixing example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@155417 c90b9560-bf6c-de11-be94-00142212c4b1
2004-04-06 20:16:16 +00:00

78 lines
2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.socket-set-block">
<refnamediv>
<refname>socket_set_block</refname>
<refpurpose>
Sets blocking mode on a socket resource
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>socket_set_block</methodname>
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
</methodsynopsis>
<para>
The <function>socket_set_block</function> function removes the O_NONBLOCK flag
on the socket specified by the <parameter>socket</parameter> parameter.
</para>
<para>
<example>
<title><function>socket_set_block</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$port = 9090;
if (!$socket = socket_create_listen($port)) {
echo socket_strerror(socket_last_error());
}
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
echo socket_strerror(socket_last_error());
}
if (!socket_set_nonblock($socket)) { // $socket is now nonblocking
echo socket_strerror(socket_last_error());
}
if (!socket_set_block($socket)) { // $socket is now blocking
echo socket_strerror(socket_last_error());
}
?>
]]>
</programlisting>
</example>
</para>
<para>
&return.success;
</para>
<para>
See also <function>socket_set_nonblock</function> and
<function>socket_set_option</function>
</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
-->