Source of: /manual/en/function.stream-set-blocking.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.stream.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.stream-set-blocking.php',
1 => 'stream_set_blocking',
),
'up' =>
array (
0 => 'ref.stream.php',
1 => 'Stream Functions',
),
'prev' =>
array (
0 => 'function.stream-select.php',
1 => 'stream_select',
),
'next' =>
array (
0 => 'function.stream-set-timeout.php',
1 => 'stream_set_timeout',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.stream-set-blocking" class="refentry">
<div class="refnamediv">
<h1 class="refname">stream_set_blocking</h1>
<p class="verinfo">(PHP 4 >= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">stream_set_blocking</span> — <span class="dc-title">Set blocking/non-blocking mode on a stream</span></p>
</div>
<a name="function.stream-set-blocking.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><b>stream_set_blocking</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$stream</tt></span>
, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$mode</tt></span>
)</div>
<p class="para rdfs-comment">
Sets blocking or non-blocking mode on a <i><tt class="parameter">stream</tt></i>
.
</p>
<p class="para">
This function works for any stream that supports non-blocking mode
(currently, regular files and socket streams).
</p>
</div>
<a name="function.stream-set-blocking.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">stream</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The stream.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">mode</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
If <i><tt class="parameter">mode</tt></i>
is 0, the given stream
will be switched to non-blocking mode, and if 1, it
will be switched to blocking mode. This affects calls like
<a href="function.fgets.php" class="function">fgets()</a> and <a href="function.fread.php" class="function">fread()</a>
that read from the stream. In non-blocking mode an
<a href="function.fgets.php" class="function">fgets()</a> call will always return right away
while in blocking mode it will wait for data to become available
on the stream.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.stream-set-blocking.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
</div>
<a name="function.stream-set-blocking.changelog"></a><div class="refsect1 changelog">
<h3 class="title">Changelog</h3>
<p class="para">
</p><table class="doctable informaltable">
<thead valign="middle">
<tr valign="middle">
<th>Version</th>
<th>Description</th>
</tr>
</thead>
<tbody valign="middle" class="tbody">
<tr valign="middle">
<td align="left">4.3.0</td>
<td align="left">
Prior to PHP 4.3.0, this function only worked on socket based streams.
</td>
</tr>
</tbody>
</table>
<p>
</p>
</div>
<a name="function.stream-set-blocking.notes"></a><div class="refsect1 notes">
<h3 class="title">Notes</h3>
<blockquote><p><b class="note">Note</b>:
This function was previously called as
<a href="function.set-socket-blocking.php" class="function">set_socket_blocking()</a> and later
<a href="function.socket-set-blocking.php" class="function">socket_set_blocking()</a> but this usage is deprecated.
<br />
</p></blockquote>
</div>
<a name="function.stream-set-blocking.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<ul class="simplelist">
<li class="member"><a href="function.stream-select.php" class="function" rel="rdfs-seeAlso">stream_select()</a> - Runs the equivalent of the select() system call on the given
arrays of streams with a timeout specified by tv_sec and tv_usec</li>
</ul>
</div>
</div><?php manual_footer(); ?>