<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sockets.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.socket-read.php',
    1 => 'socket_read',
    2 => 'Liest h&ouml;chstens die angegebene Anzahl Bytes von einem Socket',
  ),
  'up' => 
  array (
    0 => 'ref.sockets.php',
    1 => 'Socket-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.socket-listen.php',
    1 => 'socket_listen',
  ),
  'next' => 
  array (
    0 => 'function.socket-recv.php',
    1 => 'socket_recv',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/sockets/functions/socket-read.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.socket-read" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">socket_read</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">socket_read</span> &mdash; <span class="dc-title">Liest höchstens die angegebene Anzahl Bytes von einem Socket</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.socket-read-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>socket_read</strong></span>(<span class="methodparam"><span class="type"><a href="class.socket.php" class="type Socket">Socket</a></span> <code class="parameter">$socket</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$length</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = <strong><code><a href="sockets.constants.php#constant.php-binary-read">PHP_BINARY_READ</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Die Funktion <span class="function"><strong>socket_read()</strong></span> liest von der
   <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span>-Instanz <code class="parameter">socket</code>, die
   entweder mit <span class="function"><a href="function.socket-create.php" class="function">socket_create()</a></span> oder mit
   <span class="function"><a href="function.socket-accept.php" class="function">socket_accept()</a></span> erzeugt wurde.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.socket-read-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">socket</code></dt>
     <dd>
      <p class="para">
       Eine <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span>-Instanz, die mit
       <span class="function"><a href="function.socket-create.php" class="function">socket_create()</a></span> oder
       <span class="function"><a href="function.socket-accept.php" class="function">socket_accept()</a></span> erzeugt wurde.
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       Die Anzahl Bytes, die höchstens gelesen werden, wird in dem Parameter
       <code class="parameter">length</code> angegeben. Anderenfalls können Sie mit
       <code class="literal">\r</code>, <code class="literal">\n</code>, oder
       <code class="literal">\0</code> den Lesevorgang beenden (dies ist abhängig von
       dem Parameter <code class="parameter">mode</code>, siehe weiter unten).
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       Der optionale Parameter <code class="parameter">mode</code> ist eine
       vordefinierte Konstante:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="sockets.constants.php#constant.php-binary-read">PHP_BINARY_READ</a></code></strong> (Standardwert) - benutzt die
          Systemfunktion <code class="literal">recv()</code>. Das ist sicher zum Lesen
          von Binärdaten.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="sockets.constants.php#constant.php-normal-read">PHP_NORMAL_READ</a></code></strong> - Lesevorgänge werden bei
          <code class="literal">\n</code> oder <code class="literal">\r</code> beendet.
         </span>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-read-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   <span class="function"><strong>socket_read()</strong></span> gibt bei Erfolg die Daten als String
   zurück oder <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, falls ein Fehler aufgetreten ist (einschließlich, wenn
   der entfernte Host die Verbindung abgebrochen hat). Der Fehlercode kann mit
   <span class="function"><a href="function.socket-last-error.php" class="function">socket_last_error()</a></span> abgefragt werden. Dieser Fehlercode
   kann an die Funktion <span class="function"><a href="function.socket-strerror.php" class="function">socket_strerror()</a></span> übergeben werden,
   um eine textuelle Beschreibung des Fehlers zu erhalten.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    <span class="function"><strong>socket_read()</strong></span> gibt einen leeren String (&quot;&quot;) zurück, wenn
    es keine Daten mehr zu lesen gibt.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.socket-read-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
  <td>8.0.0</td>
  <td>
   <code class="parameter">socket</code> ist nun eine
   <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span>-Instanz; vorher war es eine
   <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
  </td>
 </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.socket-read-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.socket-accept.php" class="function" rel="rdfs-seeAlso">socket_accept()</a> - Akzeptiert eine Verbindung an einem Socket</span></li>
    <li><span class="function"><a href="function.socket-bind.php" class="function" rel="rdfs-seeAlso">socket_bind()</a> - Verkn&uuml;pft einen Socket mit einem Namen</span></li>
    <li><span class="function"><a href="function.socket-connect.php" class="function" rel="rdfs-seeAlso">socket_connect()</a> - Baut eine Verbindung &uuml;ber einen Socket auf</span></li>
    <li><span class="function"><a href="function.socket-listen.php" class="function" rel="rdfs-seeAlso">socket_listen()</a> - H&ouml;rt einen Socket nach Verbindungsanforderungen ab</span></li>
    <li><span class="function"><a href="function.socket-last-error.php" class="function" rel="rdfs-seeAlso">socket_last_error()</a> - Gibt den letzten Fehler zur&uuml;ck, der an einem Socket aufgetreten ist</span></li>
    <li><span class="function"><a href="function.socket-strerror.php" class="function" rel="rdfs-seeAlso">socket_strerror()</a> - Gibt einen String zur&uuml;ck, der einen Socket-Fehler beschreibt</span></li>
    <li><span class="function"><a href="function.socket-write.php" class="function" rel="rdfs-seeAlso">socket_write()</a> - Schreibt in einen Socket</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>