PHP 8.6.0 Beta 1 is available for testing

Swoole\Event::isset

(No version information available, might only be in Git)

Swoole\Event::issetCheck if a socket is being monitored in the event loop

Descripción

public static function Swoole\Event::isset(mixed $fd, int $events = SWOOLE_EVENT_READ | SWOOLE_EVENT_WRITE ): bool

Checks whether the specified file descriptor is being monitored for the given event types in the event loop.

Parámetros

fd
File descriptor (stream/socket resource, integer, or object).
events
Event types to check (bitmask of SWOOLE_EVENT_READ and/or SWOOLE_EVENT_WRITE).

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Ejemplos

Ejemplo #1 Checking event monitoring status

<?php
$fp = stream_socket_client("tcp://www.qq.com:80");
Swoole\Event::add($fp, function ($fp) {
    echo fread($fp, 8192);
}, null, SWOOLE_EVENT_READ);

var_dump(Swoole\Event::isset($fp, SWOOLE_EVENT_READ)); // Output: true
var_dump(Swoole\Event::isset($fp, SWOOLE_EVENT_WRITE)); // Output: false

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top