После применения функции
stream_select
возвращает пустой
$changed
Код:
<?php
$host = 'site.test';
$port = 9555;
$path = 'cert/';
$transport = 'tlsv1.3';
$ssl = ['ssl' => [
'local_cert' => $path . 'cert.pem', // SSL Certificate
'local_pk' => $path . 'privkey.pem', // SSL Keyfile
'disable_compression' => true, // TLS compression attack vulnerability
'verify_peer' => false, // Set this to true if acting as an SSL client
'ssltransport' => $transport, // Transport Methods such as 'tlsv1.1', tlsv1.2'
] ];
$ssl_context = stream_context_create($ssl);
$server = stream_socket_server($transport . '://' . $host . ':' . $port, $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $ssl_context);
if (!$server) { die("$errstr ($errno)"); }
$clients = array($server);
$write = NULL;
$except = NULL;
$i = 0;
file_put_contents(__DIR__."/222.txt", "-----\r\n");
while (true) {
$changed = $clients;
$i++;
if ($i > 20) {
file_put_contents(__DIR__."/222.txt",'-end-', FILE_APPEND);
fclose($socket);
die;
}
///////////////////////////////////////////////
if (false === stream_select($changed, $write, $except, 0, 100))
continue;
//////////////////////////////////////////////////////////////
$file = __DIR__."/222.txt";
$data = ['server'=>$server, 'changed'=>$changed, 'result'=>in_array($server, $changed), 'clients'=>$clients, 'write'=>$write, 'except'=>$except];
file_put_contents($file, print_r($data,1), FILE_APPEND);
?>