1--TEST--
2Test if socket_set_option() works, option:TCP_DEFER_ACCEPT
3--EXTENSIONS--
4sockets
5--SKIPIF--
6<?php
7
8if (strpos(PHP_OS, 'Linux') === false) {
9	die('SKIP on non Linux');
10}
11?>
12--FILE--
13<?php
14echo "*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***\n";
15$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
16
17if (!$socket) {
18        die('Unable to create AF_INET socket [socket]');
19}
20$initial_val = 5;
21var_dump(socket_set_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT, $initial_val));
22socket_listen($socket);
23$rounded_up_val = socket_get_option( $socket, SOL_TCP, TCP_DEFER_ACCEPT);
24socket_close($socket);
25var_dump($rounded_up_val > $initial_val); // Value rounded up by the kernel, might differ from kernel version/setting
26?>
27--EXPECT--
28*** Test with TCP_DEFER_ACCEPT with initial SYN/ACK 'timeout' value to rounded up one ***
29bool(true)
30bool(true)
31