Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 6615

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!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>Set blocking/non-blocking mode on a stream</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.stream-select.html">stream_select</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.stream-set-chunk-size.html">stream_set_chunk_size</a></div>
 <div class="up"><a href="ref.stream.html">Stream Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.stream-set-blocking" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stream_set_blocking</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">stream_set_blocking</span> &mdash; <span class="dc-title">Set blocking/non-blocking mode on a stream</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.stream-set-blocking-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>stream_set_blocking</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stream</code></span>
   , <span class="methodparam"><span class="type">bool</span> <code class="parameter">$mode</code></span>
   )</div>

  <p class="para rdfs-comment">
   Sets blocking or non-blocking mode on a <code class="parameter">stream</code>.
  </p>
  <p class="para">
   This function works for any stream that supports non-blocking mode
   (currently, regular files and socket streams).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stream-set-blocking-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">stream</code></dt>

     <dd>

      <p class="para">
       The stream.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">mode</code></dt>

     <dd>

      <p class="para">
       If <code class="parameter">mode</code> is <strong><code>FALSE</code></strong>, the given stream
       will be switched to non-blocking mode, and if <strong><code>TRUE</code></strong>, it
       will be switched to blocking mode.  This affects calls like
       <span class="function"><a href="function.fgets.html" class="function">fgets()</a></span> and <span class="function"><a href="function.fread.html" class="function">fread()</a></span>
       that read from the stream.  In non-blocking mode an
       <span class="function"><a href="function.fgets.html" class="function">fgets()</a></span> 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>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stream-set-blocking-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.stream-set-blocking-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function was previously called as
    <span class="function"><a href="function.set-socket-blocking.html" class="function">set_socket_blocking()</a></span> and later
    <span class="function"><a href="function.socket-set-blocking.html" class="function">socket_set_blocking()</a></span> but this usage is deprecated.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">On Windows, this has no affect on local files. Non-blocking IO for local files is not supported on Windows.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stream-set-blocking-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.stream-select.html" 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</span></li>
  </ul>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.stream-select.html">stream_select</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.stream-set-chunk-size.html">stream_set_chunk_size</a></div>
 <div class="up"><a href="ref.stream.html">Stream Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>