reference/stream/functions/stream-socket-client.xml
181e9c5572ed04ed712b8d7f858f61a94647c6ac
...
...
@@ -9,23 +9,23 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>resource</type><methodname>stream_socket_client</methodname>
13
-
<methodparam><type>string</type><parameter>remote_socket</parameter></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter role="reference">errno</parameter></methodparam>
15
-
<methodparam choice="opt"><type>string</type><parameter role="reference">errstr</parameter></methodparam>
16
-
<methodparam choice="opt"><type>float</type><parameter>timeout</parameter><initializer>ini_get("default_socket_timeout")</initializer></methodparam>
17
-
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>STREAM_CLIENT_CONNECT</initializer></methodparam>
18
-
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
12
+
<type class="union"><type>resource</type><type>false</type></type><methodname>stream_socket_client</methodname>
13
+
<methodparam><type>string</type><parameter>address</parameter></methodparam>
14
+
<methodparam choice="opt"><type>int</type><parameter role="reference">error_code</parameter><initializer>&null;</initializer></methodparam>
15
+
<methodparam choice="opt"><type>string</type><parameter role="reference">error_message</parameter><initializer>&null;</initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>float</type><type>null</type></type><parameter>timeout</parameter><initializer>&null;</initializer></methodparam>
17
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer><constant>STREAM_CLIENT_CONNECT</constant></initializer></methodparam>
18
+
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
19
19
</methodsynopsis>
20
20
<para>
21
21
Initiates a stream or datagram connection to the destination specified
22
-
by <parameter>remote_socket</parameter>. The type of socket created
22
+
by <parameter>address</parameter>. The type of socket created
23
23
is determined by the transport specified using standard URL formatting:
24
24
<literal>transport://target</literal>. For Internet Domain sockets
25
25
(AF_INET) such as TCP and UDP, the <literal>target</literal> portion
26
-
of the <parameter>remote_socket</parameter> parameter should consist of
26
+
of the <parameter>address</parameter> parameter should consist of
27
27
a hostname or IP address followed by a colon and a port number. For Unix
28
-
domain sockets, the <parameter>target</parameter> portion should point
28
+
domain sockets, the <literal>target</literal> portion should point
29
29
to the socket file on the filesystem.
30
30
</para>
31
31
<note>
...
...
@@ -42,7 +42,7 @@
42
42
<para>
43
43
<variablelist>
44
44
<varlistentry>
45
-
<term><parameter>remote_socket</parameter></term>
45
+
<term><parameter>address</parameter></term>
46
46
<listitem>
47
47
<para>
48
48
Address to the socket to connect to.
...
...
@@ -50,7 +50,7 @@
50
50
</listitem>
51
51
</varlistentry>
52
52
<varlistentry>
53
-
<term><parameter>errno</parameter></term>
53
+
<term><parameter>error_code</parameter></term>
54
54
<listitem>
55
55
<para>
56
56
Will be set to the system level error number if connection fails.
...
...
@@ -58,7 +58,7 @@
58
58
</listitem>
59
59
</varlistentry>
60
60
<varlistentry>
61
-
<term><parameter>errstr</parameter></term>
61
+
<term><parameter>error_message</parameter></term>
62
62
<listitem>
63
63
<para>
64
64
Will be set to the system level error message if the connection fails.
...
...
@@ -70,7 +70,8 @@
70
70
<listitem>
71
71
<para>
72
72
Number of seconds until the <literal>connect()</literal> system call
73
-
should timeout.
73
+
should timeout. By default, <link linkend="ini.default-socket-timeout">default_socket_timeout</link>
74
+
is used.
74
75
<note>
75
76
<simpara>
76
77
This parameter only applies when not making asynchronous
...
...
@@ -126,20 +127,41 @@
126
127
<refsect1 role="errors"><!-- {{{ -->
127
128
&reftitle.errors;
128
129
<para>
129
-
On failure the <parameter>errno</parameter> and
130
-
<parameter>errstr</parameter> arguments will be populated with the actual
130
+
On failure the <parameter>error_code</parameter> and
131
+
<parameter>error_message</parameter> arguments will be populated with the actual
131
132
system level error that occurred in the system-level
132
133
<literal>connect()</literal> call. If the value returned in
133
-
<parameter>errno</parameter> is <literal>0</literal> and the
134
+
<parameter>error_code</parameter> is <literal>0</literal> and the
134
135
function returned &false;, it is an indication that the error
135
136
occurred before the <literal>connect()</literal> call. This is
136
137
most likely due to a problem initializing the socket. Note that
137
-
the <parameter>errno</parameter> and
138
-
<parameter>errstr</parameter> arguments will always be passed by
138
+
the <parameter>error_code</parameter> and
139
+
<parameter>error_message</parameter> arguments will always be passed by
139
140
reference.
140
141
</para>
141
142
</refsect1><!-- }}} -->
142
143

144
+
<refsect1 role="changelog">
145
+
&reftitle.changelog;
146
+
<informaltable>
147
+
<tgroup cols="2">
148
+
<thead>
149
+
<row>
150
+
<entry>&Version;</entry>
151
+
<entry>&Description;</entry>
152
+
</row>
153
+
</thead>
154
+
<tbody>
155
+
<row>
156
+
<entry>8.0.0</entry>
157
+
<entry>
158
+
<parameter>timeout</parameter> and <parameter>context</parameter> are now nullable.
159
+
</entry>
160
+
</row>
161
+
</tbody>
162
+
</tgroup>
163
+
</informaltable>
164
+
</refsect1>
143
165
144
166
<refsect1 role="examples"><!-- {{{ -->
145
167
&reftitle.examples;
...
...
@@ -223,13 +245,12 @@ if (!$fp) {
223
245
<member><function>fwrite</function></member>
224
246
<member><function>fclose</function></member>
225
247
<member><function>feof</function></member>
226
-
<member><xref linkend="ref.curl" /></member>
248
+
<member><xref linkend="ref.curl"/></member>
227
249
</simplelist>
228
250
</para>
229
251
</refsect1><!-- }}} -->
230
252

231
253
</refentry>
232
-

233
254
<!-- Keep this comment at the end of the file
234
255
Local variables:
235
256
mode: sgml
236
257