1--TEST--
2mixed socket_getopt( resource $socket , int $level , int $optname ) ;
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
5--EXTENSIONS--
6sockets
7--FILE--
8<?php
9$domain = AF_INET;
10$level = IPPROTO_IP;
11$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
12
13echo "Setting IP_MULTICAST_TTL\n";
14$r = socket_set_option($s, $level, IP_MULTICAST_TTL, 9);
15var_dump($r);
16$r = socket_getopt($s, $level, IP_MULTICAST_TTL);
17var_dump($r);
18echo "\n";
19
20echo "Setting IP_MULTICAST_LOOP\n";
21$r = socket_set_option($s, $level, IP_MULTICAST_LOOP, 0);
22var_dump($r);
23$r = socket_getopt($s, $level, IP_MULTICAST_LOOP);
24var_dump($r);
25$r = socket_set_option($s, $level, IP_MULTICAST_LOOP, 1);
26var_dump($r);
27$r = socket_getopt($s, $level, IP_MULTICAST_LOOP);
28var_dump($r);
29echo "\n";
30
31echo "Setting IP_MULTICAST_IF\n";
32echo "interface 0:\n";
33$r = socket_set_option($s, $level, IP_MULTICAST_IF, 0);
34var_dump($r);
35$r = socket_getopt($s, $level, IP_MULTICAST_IF);
36var_dump($r);
37echo "interface 1:\n";
38$r = socket_set_option($s, $level, IP_MULTICAST_IF, 1);
39var_dump($r);
40$r = socket_getopt($s, $level, IP_MULTICAST_IF);
41var_dump($r);
42echo "\n";
43?>
44--CLEAN--
45<?php
46unset($domain);
47unset($level);
48socket_close($s);
49unset($s);
50unset($r");
51?>
52--EXPECT--
53Setting IP_MULTICAST_TTL
54bool(true)
55int(9)
56
57Setting IP_MULTICAST_LOOP
58bool(true)
59int(0)
60bool(true)
61int(1)
62
63Setting IP_MULTICAST_IF
64interface 0:
65bool(true)
66int(0)
67interface 1:
68bool(true)
69int(1)
70