mirror of
https://github.com/php/doc-it.git
synced 2026-03-24 15:42:46 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314557 c90b9560-bf6c-de11-be94-00142212c4b1
91 lines
3.3 KiB
XML
91 lines
3.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- splitted from ./it/functions/sockets.xml, last change in rev 1.4 -->
|
|
<!-- last change to 'socket-read' in en/ tree in rev 1.8 -->
|
|
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
|
|
<!-- OLD-Revision: 1.34/EN.1.8 -->
|
|
<refentry xml:id="function.socket-read" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>socket_read</refname>
|
|
<refpurpose>Legge fino ad un massimo di byte predefiniti da un socket</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>socket_read</methodname>
|
|
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>lunghezza</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>tipo</parameter></methodparam>
|
|
</methodsynopsis>
|
|
&warn.experimental.func;
|
|
<para>
|
|
La funzione <function>socket_read</function> legge un numero massimo di byte,
|
|
indicato in <parameter>lunghezza</parameter>, da un socket <parameter>socket</parameter>
|
|
creato dalla funzione <function>socket_accept</function> oppure da <function>socket_create</function>.
|
|
In alternativa si possono usare i caratteri \n, \r o \0 per indicare
|
|
la fine della lettura (in base al parametro <parameter>tipo</parameter>,
|
|
vedere più avanti)
|
|
</para>
|
|
<para>
|
|
La funzione restituisce i dati come una stringa in caso di successo, &false; su errore.
|
|
Il codice di errore può essere recuperato con <function>socket_last_error</function>.
|
|
Questo codice può essere passato a <function>socket_strerror</function> per ottenere
|
|
una descrizione dell'errore.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
<function>socket_read</function> può restituire una stringa di lunghezza zero ("")
|
|
indicante la fine della comunicazione (ad esempio il server remoto ha chiuso
|
|
la connessione).
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Il parametro opzionale <parameter>tipo</parameter> può assumere i seguenti valori:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
PHP_BINARY_READ - usa la funzione di sistema <literal>read()</literal>.
|
|
Salvaguarda la lettura di dati binari
|
|
(Default in PHP >= 4.1.0)
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
PHP_NORMAL_READ - ferma la lettura in presenza di \n oppure \r. (Default in PHP <= 4.0.6)
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
<para>
|
|
Vedere anche
|
|
<function>socket_accept</function>,
|
|
<function>socket_bind</function>,
|
|
<function>socket_connect</function>,
|
|
<function>socket_listen</function>,
|
|
<function>socket_last_error</function>,
|
|
<function>socket_strerror</function> e
|
|
<function>socket_write</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:"~/.phpdoc/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
|
|
-->
|