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--EXPECT-- 45Setting IP_MULTICAST_TTL 46bool(true) 47int(9) 48 49Setting IP_MULTICAST_LOOP 50bool(true) 51int(0) 52bool(true) 53int(1) 54 55Setting IP_MULTICAST_IF 56interface 0: 57bool(true) 58int(0) 59interface 1: 60bool(true) 61int(1) 62