Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Closes an open file pointer
<?php fclose(resource $stream): bool
<?php $meta = \stream_get_meta_data($this->master);
if (!isset($meta['stream_type']) || $meta['stream_type'] !== 'tcp_socket') {
\fclose($this->master);
$errno = \defined('SOCKET_ENOTSOCK') ? \SOCKET_ENOTSOCK : 88;
$errstr = \function_exists('socket_strerror') ? \socket_strerror($errno) : 'Not a socket';
<?php if (\stream_socket_get_name($this->master, true) !== false) {
\fclose($this->master);
$errno = \defined('SOCKET_EISCONN') ? \SOCKET_EISCONN : 106;
$errstr = \function_exists('socket_strerror') ? \socket_strerror($errno) : 'Socket is connected';
<?php }
$this->pause();
\fclose($this->master);
$this->removeAllListeners();
}
<?php }
\fclose($stream);
$reject(new \RuntimeException(
'Connection to ' . $uri . ' failed: ' . $errstr . SocketServer::errconst($errno),
$errno
<?php });
}, function () use ($loop, $stream, $uri) {
$loop->removeWriteStream($stream);
\fclose($stream);
<?php if (\PHP_VERSION_ID < 50400 && \is_resource($stream)) {
\fclose($stream);
}
<?php }
$this->pause();
\fclose($this->master);
$this->removeAllListeners();
}
<?php }
$this->pause();
\fclose($this->master);
$this->removeAllListeners();
}
<?php $this->assertInstanceOf('React\Socket\ConnectionInterface', $connection);
fclose($client);
$connection->close();
$server->close();
}
<?php stream_socket_sendto($socket, $response, 0, $peer);
++$received;
fclose($client);
});
$connection = Block\await($connector->connect('example.com:80'));
<?php $tcp = new TcpServer(0);
$socket = stream_socket_client($tcp->getAddress());
fclose($socket);
$server = new LimitingServer($tcp, 100);
$server->on('connection', $this->expectCallableOnce());
<?php Block\await($peer, null, self::TIMEOUT);
fclose($first);
fclose($second);
$server->close();
<?php Block\await($peer, null, self::TIMEOUT);
fclose($first);
fclose($second);
$server->close();
}
<?php });
$first = stream_socket_client($server->getAddress());
fclose($first);
$second = stream_socket_client($server->getAddress());
fclose($second);
<?php $first = stream_socket_client($server->getAddress());
fclose($first);
$second = stream_socket_client($server->getAddress());
fclose($second);
Block\await($peer, null, self::TIMEOUT);