reference/sockets/functions/socket-get-option.xml
eb1f12738221677a2d94d94e8dbddd88c6143c94
...
...
@@ -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-get-option">
3
+
<refentry xml:id="function.socket-get-option" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>socket_get_option</refname>
6
6
<refpurpose>Gets socket options for the socket </refpurpose>
...
...
@@ -9,14 +9,14 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>mixed</type><methodname>socket_get_option</methodname>
13
-
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
12
+
<type class="union"><type>array</type><type>int</type><type>false</type></type><methodname>socket_get_option</methodname>
13
+
<methodparam><type>Socket</type><parameter>socket</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter>level</parameter></methodparam>
15
-
<methodparam><type>int</type><parameter>optname</parameter></methodparam>
15
+
<methodparam><type>int</type><parameter>option</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
The <function>socket_get_option</function> function retrieves the value for
19
-
the option specified by the <parameter>optname</parameter> parameter for the
19
+
the option specified by the <parameter>option</parameter> parameter for the
20
20
specified <parameter>socket</parameter>.
21
21
</para>
22
22
</refsect1>
...
...
@@ -29,7 +29,7 @@
29
29
<term><parameter>socket</parameter></term>
30
30
<listitem>
31
31
<para>
32
-
A valid socket resource created with <function>socket_create</function>
32
+
A <classname>Socket</classname> instance created with <function>socket_create</function>
33
33
or <function>socket_accept</function>.
34
34
</para>
35
35
</listitem>
...
...
@@ -49,7 +49,7 @@
49
49
</listitem>
50
50
</varlistentry>
51
51
<varlistentry>
52
-
<term><parameter>optname</parameter></term>
52
+
<term><parameter>option</parameter></term>
53
53
<listitem>
54
54
<table>
55
55
<title>Available Socket Options</title>
...
...
@@ -253,7 +253,7 @@
253
253
<row>
254
254
<entry><constant>MCAST_JOIN_GROUP</constant></entry>
255
255
<entry>
256
-
Joins a multicast group. (added in PHP 5.4)
256
+
Joins a multicast group.
257
257
</entry>
258
258
<entry>
259
259
<type>array</type> with keys <literal>"group"</literal>, specifying
...
...
@@ -269,7 +269,7 @@
269
269
<row>
270
270
<entry><constant>MCAST_LEAVE_GROUP</constant></entry>
271
271
<entry>
272
-
Leaves a multicast group. (added in PHP 5.4)
272
+
Leaves a multicast group.
273
273
</entry>
274
274
<entry>
275
275
<type>array</type>. See <constant>MCAST_JOIN_GROUP</constant> for
...
...
@@ -282,7 +282,6 @@
282
282
<entry>
283
283
Blocks packets arriving from a specific source to a specific
284
284
multicast group, which must have been previously joined.
285
-
(added in PHP 5.4)
286
285
</entry>
287
286
<entry>
288
287
<type>array</type> with the same keys as
...
...
@@ -297,7 +296,7 @@
297
296
<entry>
298
297
Unblocks (start receiving again) packets arriving from a specific
299
298
source address to a specific multicast group, which must have been
300
-
previously joined. (added in PHP 5.4)
299
+
previously joined.
301
300
</entry>
302
301
<entry>
303
302
<type>array</type> with the same format as
...
...
@@ -309,7 +308,7 @@
309
308
<entry><constant>MCAST_JOIN_SOURCE_GROUP</constant></entry>
310
309
<entry>
311
310
Receive packets destined to a specific multicast group whose source
312
-
address matches a specific value. (added in PHP 5.4)
311
+
address matches a specific value.
313
312
</entry>
314
313
<entry>
315
314
<type>array</type> with the same format as
...
...
@@ -321,7 +320,7 @@
321
320
<entry><constant>MCAST_LEAVE_SOURCE_GROUP</constant></entry>
322
321
<entry>
323
322
Stop receiving packets destined to a specific multicast group whose
324
-
source address matches a specific value. (added in PHP 5.4)
323
+
source address matches a specific value.
325
324
</entry>
326
325
<entry>
327
326
<type>array</type> with the same format as
...
...
@@ -333,7 +332,6 @@
333
332
<entry><constant>IP_MULTICAST_IF</constant></entry>
334
333
<entry>
335
334
The outgoing interface for IPv4 multicast packets.
336
-
(added in PHP 5.4)
337
335
</entry>
338
336
<entry>
339
337
Either <type>int</type> specifying the interface number or a
...
...
@@ -352,7 +350,6 @@
352
350
<entry><constant>IPV6_MULTICAST_IF</constant></entry>
353
351
<entry>
354
352
The outgoing interface for IPv6 multicast packets.
355
-
(added in PHP 5.4)
356
353
</entry>
357
354
<entry>
358
355
The same as <constant>IP_MULTICAST_IF</constant>.
...
...
@@ -361,12 +358,11 @@
361
358
<row>
362
359
<entry><constant>IP_MULTICAST_LOOP</constant></entry>
363
360
<entry>
364
-
The multicast loopback policy for IPv4 packets, which
365
-
determines whether multicast packets sent by this socket also reach
366
-
receivers in the same host that have joined the same multicast group
367
-
on the outgoing interface used by this socket. This is the case by
368
-
default.
369
-
(added in PHP 5.4)
361
+
The multicast loopback policy for IPv4 packets enables or disables
362
+
loopback of outgoing multicasts, which must have been previously joined.
363
+
The effect differs, however, whether it applies on unixes or Windows,
364
+
the former being on the receive path whereas the latter being
365
+
on the send path.
370
366
</entry>
371
367
<entry>
372
368
<type>int</type> (either <literal>0</literal> or
...
...
@@ -379,7 +375,6 @@
379
375
<entry><constant>IPV6_MULTICAST_LOOP</constant></entry>
380
376
<entry>
381
377
Analogous to <constant>IP_MULTICAST_LOOP</constant>, but for IPv6.
382
-
(added in PHP 5.4)
383
378
</entry>
384
379
<entry>
385
380
<type>int</type>. See <constant>IP_MULTICAST_LOOP</constant>.
...
...
@@ -391,7 +386,6 @@
391
386
The time-to-live of outgoing IPv4 multicast packets. This should be
392
387
a value between 0 (don't leave the interface) and 255. The default
393
388
value is 1 (only the local network is reached).
394
-
(added in PHP 5.4)
395
389
</entry>
396
390
<entry>
397
391
<type>int</type> between 0 and 255.
...
...
@@ -403,12 +397,169 @@
403
397
Analogous to <constant>IP_MULTICAST_TTL</constant>, but for IPv6
404
398
packets. The value -1 is also accepted, meaning the route default
405
399
should be used.
406
-
(added in PHP 5.4)
407
400
</entry>
408
401
<entry>
409
402
<type>int</type> between -1 and 255.
410
403
</entry>
411
404
</row>
405
+
<row>
406
+
<entry><constant>SO_MARK</constant></entry>
407
+
<entry>
408
+
Sets an identifier on the socket for packet filtering
409
+
purpose on Linux.
410
+
</entry>
411
+
<entry>
412
+
<type>int</type>
413
+
</entry>
414
+
</row>
415
+
<row>
416
+
<entry><constant>SO_ACCEPTFILTER</constant></entry>
417
+
<entry>
418
+
Adds an accept filter on the listened socket (FreeBSD/NetBSD).
419
+
An accept filter kernel module needs to be loaded beforehand
420
+
on FreeBSD (e.g. accf_http).
421
+
</entry>
422
+
<entry>
423
+
<type>string</type> name of the filter (length 15 max).
424
+
</entry>
425
+
</row>
426
+
<row>
427
+
<entry><constant>SO_USER_COOKIE</constant></entry>
428
+
<entry>
429
+
Sets an identifier on the socket for packet filtering
430
+
purpose on FreeBSD.
431
+
</entry>
432
+
<entry>
433
+
<type>int</type>
434
+
</entry>
435
+
</row>
436
+
<row>
437
+
<entry><constant>SO_RTABLE</constant></entry>
438
+
<entry>
439
+
Sets an identifier on the socket for packet filtering
440
+
purpose on OpenBSD.
441
+
</entry>
442
+
<entry>
443
+
<type>int</type>
444
+
</entry>
445
+
</row>
446
+
<row>
447
+
<entry><constant>SO_DONTTRUNC</constant></entry>
448
+
<entry>
449
+
Retain unread data.
450
+
</entry>
451
+
<entry>
452
+
<type>int</type>
453
+
</entry>
454
+
</row>
455
+
<row>
456
+
<entry><constant>SO_WANTMORE</constant></entry>
457
+
<entry>
458
+
Give a hint when more data is ready.
459
+
</entry>
460
+
<entry>
461
+
<type>int</type>
462
+
</entry>
463
+
</row>
464
+
<row>
465
+
<entry><constant>TCP_DEFER_ACCEPT</constant></entry>
466
+
<entry>
467
+
Don't notify a listening socket until data is ready.
468
+
</entry>
469
+
<entry>
470
+
<type>int</type>
471
+
</entry>
472
+
</row>
473
+
<row>
474
+
<entry><constant>SO_INCOMING_CPU</constant></entry>
475
+
<entry>
476
+
Gets/Sets the cpu affinity of a socket.
477
+
</entry>
478
+
<entry>
479
+
<type>int</type>
480
+
</entry>
481
+
</row>
482
+
<row>
483
+
<entry><constant>SO_MEMINFO</constant></entry>
484
+
<entry>
485
+
Gets all the meminfo of a socket.
486
+
</entry>
487
+
<entry>
488
+
<type>int</type>
489
+
</entry>
490
+
</row>
491
+
<row>
492
+
<entry><constant>SO_BPF_EXTENSIONS</constant></entry>
493
+
<entry>
494
+
Gets the supported BPF extensions by the kernel to attach to a socket.
495
+
</entry>
496
+
<entry>
497
+
<type>int</type>
498
+
</entry>
499
+
</row>
500
+
<row>
501
+
<entry><constant>SO_SETFIB</constant></entry>
502
+
<entry>
503
+
Sets the route table (FIB) of a socket. (FreeBSD only)
504
+
</entry>
505
+
<entry>
506
+
<type>int</type>
507
+
</entry>
508
+
</row>
509
+
<row>
510
+
<entry><constant>SOL_FILTER</constant></entry>
511
+
<entry>
512
+
Filters attributed to a socket. (Solaris/Illumos only)
513
+
</entry>
514
+
<entry>
515
+
<type>int</type>
516
+
</entry>
517
+
</row>
518
+
<row>
519
+
<entry><constant>TCP_KEEPCNT</constant></entry>
520
+
<entry>
521
+
Sets the maximum number of keepalive probes TCP should send before dropping the connection.
522
+
</entry>
523
+
<entry>
524
+
<type>int</type>
525
+
</entry>
526
+
</row>
527
+
<row>
528
+
<entry><constant>TCP_KEEPIDLE</constant></entry>
529
+
<entry>
530
+
Sets the time the connection needs to remain idle.
531
+
</entry>
532
+
<entry>
533
+
<type>int</type>
534
+
</entry>
535
+
</row>
536
+
<row>
537
+
<entry><constant>TCP_KEEPINTVL</constant></entry>
538
+
<entry>
539
+
Sets the time between individual keepalive probes.
540
+
</entry>
541
+
<entry>
542
+
<type>int</type>
543
+
</entry>
544
+
</row>
545
+
<row>
546
+
<entry><constant>TCP_KEEPALIVE</constant></entry>
547
+
<entry>
548
+
Sets the time the connection needs to remain idle. (macOS only)
549
+
</entry>
550
+
<entry>
551
+
<type>int</type>
552
+
</entry>
553
+
</row>
554
+
<row>
555
+
<entry><constant>TCP_NOTSENT_LOWAT</constant></entry>
556
+
<entry>
557
+
Sets the limit number of unsent data in write queue by the socket stream. (Linux only)
558
+
</entry>
559
+
<entry>
560
+
<type>int</type>
561
+
</entry>
562
+
</row>
412
563
</tbody>
413
564
</tgroup>
414
565
</table>
...
...
@@ -421,10 +572,27 @@
421
572
<refsect1 role="returnvalues">
422
573
&reftitle.returnvalues;
423
574
<para>
424
-
Returns the value of the given option, or &false; on errors.
575
+
Returns the value of the given option, &return.falseforfailure;.
425
576
</para>
426
577
</refsect1>
427
578

579
+
<refsect1 role="changelog">
580
+
&reftitle.changelog;
581
+
<informaltable>
582
+
<tgroup cols="2">
583
+
<thead>
584
+
<row>
585
+
<entry>&Version;</entry>
586
+
<entry>&Description;</entry>
587
+
</row>
588
+
</thead>
589
+
<tbody>
590
+
&sockets.changelog.socket-param;
591
+
</tbody>
592
+
</tgroup>
593
+
</informaltable>
594
+
</refsect1>
595
+

428
596
<refsect1 role="examples">
429
597
&reftitle.examples;
430
598
<para>
...
...
@@ -457,7 +625,6 @@ var_dump(socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR));
457
625
</refsect1>
458
626

459
627
</refentry>
460
-

461
628
<!-- Keep this comment at the end of the file
462
629
Local variables:
463
630
mode: sgml
464
631