-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsocket-read.xml
90 lines (89 loc) · 3.31 KB
/
socket-read.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?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
-->