2003-05-29 19:45:29 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-06-20 22:25:43 +00:00
|
|
|
<!-- $Revision: 1.8 $ -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-set-block">
|
2007-06-15 00:16:44 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>socket_set_block</refname>
|
|
|
|
<refpurpose>Sets blocking mode on a socket resource</refpurpose>
|
|
|
|
</refnamediv>
|
2007-06-15 00:16:46 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-06-15 00:16:44 +00:00
|
|
|
<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>
|
2007-06-15 00:16:46 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>socket</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
&return.success;
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-06-15 00:16:44 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>socket_set_block</function> example</title>
|
|
|
|
<programlisting role="php">
|
2004-01-29 20:33:36 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-01-30 10:13:50 +00:00
|
|
|
|
2004-01-29 20:33:36 +00:00
|
|
|
$port = 9090;
|
2007-01-16 22:21:23 +00:00
|
|
|
if (($socket = socket_create_listen($port)) === false) {
|
|
|
|
echo "socket_create_listen() failed. Reason: ".socket_strerror(socket_last_error());
|
2004-01-29 20:33:36 +00:00
|
|
|
}
|
2004-01-30 10:13:50 +00:00
|
|
|
|
2007-01-16 22:21:23 +00:00
|
|
|
if (socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1) === false) {
|
|
|
|
echo "socket_set_option() failed. Reason: ".socket_strerror(socket_last_error($socket));
|
2004-01-29 20:33:36 +00:00
|
|
|
}
|
2004-01-30 10:13:50 +00:00
|
|
|
|
2007-01-16 22:21:23 +00:00
|
|
|
if (socket_set_nonblock($socket) === false) { // $socket is now nonblocking
|
|
|
|
echo "socket_set_nonblock() failed. Reason: ".socket_strerror(socket_last_error($socket));
|
2004-01-29 20:33:36 +00:00
|
|
|
}
|
2004-01-30 10:13:50 +00:00
|
|
|
|
2007-01-16 22:21:23 +00:00
|
|
|
if (socket_set_block($socket) === false) { // $socket is now blocking
|
|
|
|
echo "socket_set_block() failed. Reason: ". socket_strerror(socket_last_error($socket));
|
2004-01-29 20:33:36 +00:00
|
|
|
}
|
2004-01-30 10:13:50 +00:00
|
|
|
|
2004-01-29 20:33:36 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2007-06-15 00:16:44 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-06-15 00:16:46 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-06-15 00:16:44 +00:00
|
|
|
<para>
|
2007-06-15 00:16:46 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>socket_set_nonblock</function></member>
|
|
|
|
<member><function>socket_set_option</function></member>
|
|
|
|
</simplelist>
|
2007-06-15 00:16:44 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-06-15 00:16:46 +00:00
|
|
|
|
2007-06-15 00:16:44 +00:00
|
|
|
</refentry>
|
2003-05-29 19:45:29 +00:00
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|