1--TEST--
2Test socket_setopt() basic functionality
3--CREDITS--
4Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
5User Group: PHPSP #PHPTestFestBrasil
6--SKIPIF--
7<?php
8if (!extension_loaded('sockets')) {
9    die('skip. Sockets extension is not available.');
10}
11?>
12--FILE--
13<?php
14$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
15if (!$socket) {
16    die('Unable to create AF_INET socket [socket]');
17}
18socket_set_block($socket);
19
20//set/get comparison
21$options = array("sec" => 1, "usec" => 0);
22$retval_1 = socket_setopt( $socket, SOL_SOCKET, SO_SNDTIMEO, $options);
23$retval_2 = socket_getopt( $socket, SOL_SOCKET, SO_SNDTIMEO);
24
25var_dump($retval_1);
26var_dump($retval_2 === $options);
27socket_close($socket);
28?>
29--EXPECT--
30bool(true)
31bool(true)
32