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