1--TEST--
2stream context tcp_nodelay server
3--EXTENSIONS--
4sockets
5--FILE--
6<?php
7$serverCode = <<<'CODE'
8   $ctxt = stream_context_create([
9        "socket" => [
10            "tcp_nodelay" => true
11        ]
12    ]);
13
14    $server = stream_socket_server(
15        "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt);
16
17    $client = stream_socket_accept($server);
18
19    var_dump(socket_get_option(
20                socket_import_stream($server),
21                    SOL_TCP, TCP_NODELAY) > 0);
22
23    var_dump(socket_get_option(
24                socket_import_stream($client),
25                    SOL_TCP, TCP_NODELAY) > 0);
26
27    fclose($client);
28    fclose($server);
29CODE;
30
31$clientCode = <<<'CODE'
32    $test = stream_socket_client(
33        "tcp://127.0.0.1:9099", $errno, $errstr, 10);
34
35    sleep(1);
36
37    fclose($test);
38CODE;
39
40include sprintf(
41    "%s/../../../openssl/tests/ServerClientTestCase.inc",
42    __DIR__);
43ServerClientTestCase::getInstance()->run($serverCode, $clientCode);
44?>
45--EXPECT--
46bool(false)
47bool(true)
48