reference/sockets/functions/socket-recvfrom.xml
de9c65c91ff1710d8b2d2ec955caea0162679305
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.socket-recvfrom">
3
+
<refentry xml:id="function.socket-recvfrom" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>socket_recvfrom</refname>
6
6
<refpurpose>Receives data from a socket whether or not it is connection-oriented</refpurpose>
...
...
@@ -9,18 +9,18 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>int</type><methodname>socket_recvfrom</methodname>
13
-
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter role="reference">buf</parameter></methodparam>
15
-
<methodparam><type>int</type><parameter>len</parameter></methodparam>
12
+
<type class="union"><type>int</type><type>false</type></type><methodname>socket_recvfrom</methodname>
13
+
<methodparam><type>Socket</type><parameter>socket</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter role="reference">data</parameter></methodparam>
15
+
<methodparam><type>int</type><parameter>length</parameter></methodparam>
16
16
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
17
-
<methodparam><type>string</type><parameter role="reference">name</parameter></methodparam>
18
-
<methodparam choice="opt"><type>int</type><parameter role="reference">port</parameter></methodparam>
17
+
<methodparam><type>string</type><parameter role="reference">address</parameter></methodparam>
18
+
<methodparam choice="opt"><type>int</type><parameter role="reference">port</parameter><initializer>&null;</initializer></methodparam>
19
19
</methodsynopsis>
20
20
<para>
21
21
The <function>socket_recvfrom</function> function receives
22
-
<parameter>len</parameter> bytes of data in <parameter>buf</parameter> from
23
-
<parameter>name</parameter> on port <parameter>port</parameter> (if the
22
+
<parameter>length</parameter> bytes of data in <parameter>data</parameter> from
23
+
<parameter>address</parameter> on port <parameter>port</parameter> (if the
24
24
socket is not of type <constant>AF_UNIX</constant>) using
25
25
<parameter>socket</parameter>. <function>socket_recvfrom</function> can be
26
26
used to gather data from both connected and unconnected sockets.
...
...
@@ -28,11 +28,11 @@
28
28
the function.
29
29
</para>
30
30
<para>
31
-
The <parameter>name</parameter> and <parameter>port</parameter> must be
31
+
The <parameter>address</parameter> and <parameter>port</parameter> must be
32
32
passed by reference. If the socket is not connection-oriented,
33
-
<parameter>name</parameter> will be set to the internet protocol address of
33
+
<parameter>address</parameter> will be set to the internet protocol address of
34
34
the remote host or the path to the UNIX socket. If the socket is
35
-
connection-oriented, <parameter>name</parameter> is &null;. Additionally,
35
+
connection-oriented, <parameter>address</parameter> is &null;. Additionally,
36
36
the <parameter>port</parameter> will contain the port of the remote host in
37
37
the case of an unconnected <constant>AF_INET</constant> or
38
38
<constant>AF_INET6</constant> socket.
...
...
@@ -48,27 +48,27 @@
48
48
<term><parameter>socket</parameter></term>
49
49
<listitem>
50
50
<para>
51
-
The <parameter>socket</parameter> must be a socket resource previously
51
+
The <parameter>socket</parameter> must be a <classname>Socket</classname> instance previously
52
52
created by socket_create().
53
53
</para>
54
54
</listitem>
55
55
</varlistentry>
56
56

57
57
<varlistentry>
58
-
<term><parameter>buf</parameter></term>
58
+
<term><parameter>data</parameter></term>
59
59
<listitem>
60
60
<para>
61
61
The data received will be fetched to the variable specified with
62
-
<parameter>buf</parameter>.
62
+
<parameter>data</parameter>.
63
63
</para>
64
64
</listitem>
65
65
</varlistentry>
66
66

67
67
<varlistentry>
68
-
<term><parameter>len</parameter></term>
68
+
<term><parameter>length</parameter></term>
69
69
<listitem>
70
70
<para>
71
-
Up to <parameter>len</parameter> bytes will be fetched from remote host.
71
+
Up to <parameter>length</parameter> bytes will be fetched from remote host.
72
72
</para>
73
73
</listitem>
74
74
</varlistentry>
...
...
@@ -108,7 +108,7 @@
108
108
<row>
109
109
<entry><constant>MSG_WAITALL</constant></entry>
110
110
<entry>
111
-
Block until at least <parameter>len</parameter> are received.
111
+
Block until at least <parameter>length</parameter> are received.
112
112
However, if a signal is caught or the remote host disconnects, the
113
113
function may return less data.
114
114
</entry>
...
...
@@ -127,12 +127,12 @@
127
127
</varlistentry>
128
128

129
129
<varlistentry>
130
-
<term><parameter>name</parameter></term>
130
+
<term><parameter>address</parameter></term>
131
131
<listitem>
132
132
<para>
133
133
If the socket is of the type <constant>AF_UNIX</constant> type,
134
-
<parameter>name</parameter> is the path to the file. Else, for
135
-
unconnected sockets, <parameter>name</parameter> is the IP address of,
134
+
<parameter>address</parameter> is the path to the file. Else, for
135
+
unconnected sockets, <parameter>address</parameter> is the IP address of,
136
136
the remote host, or &null; if the socket is connection-oriented.
137
137
</para>
138
138
</listitem>
...
...
@@ -165,6 +165,23 @@
165
165
</para>
166
166
</refsect1>
167
167

168
+
<refsect1 role="changelog">
169
+
&reftitle.changelog;
170
+
<informaltable>
171
+
<tgroup cols="2">
172
+
<thead>
173
+
<row>
174
+
<entry>&Version;</entry>
175
+
<entry>&Description;</entry>
176
+
</row>
177
+
</thead>
178
+
<tbody>
179
+
&sockets.changelog.socket-param;
180
+
</tbody>
181
+
</tgroup>
182
+
</informaltable>
183
+
</refsect1>
184
+

168
185
<refsect1 role="examples">
169
186
&reftitle.examples;
170
187
<para>
...
...
@@ -173,7 +190,6 @@
173
190
<programlisting role="php">
174
191
<![CDATA[
175
192
<?php
176
-
error_reporting(E_ALL | E_STRICT);
177
193

178
194
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
179
195
socket_bind($socket, '127.0.0.1', 1223);
...
...
@@ -206,7 +222,6 @@ echo "Received $buf from remote address $from and remote port $port" . PHP_EOL;
206
222
</para>
207
223
</refsect1>
208
224
</refentry>
209
-

210
225
<!-- Keep this comment at the end of the file
211
226
Local variables:
212
227
mode: sgml
213
228