exist(int $fd):bool;" statement to detect whether the connection corresponding to fd exists. If the TCP connection corresponding to $fd exists, it returns true, and if it does not, it returns false. $fd is the identifier of the TCP client connection."/> exist(int $fd):bool;" statement to detect whether the connection corresponding to fd exists. If the TCP connection corresponding to $fd exists, it returns true, and if it does not, it returns false. $fd is the identifier of the TCP client connection.">

Home >PHP Framework >Swoole >How to use swoole to monitor whether the client is disconnected

How to use swoole to monitor whether the client is disconnected

尚
Original
2019-12-17 09:53:193308browse

How to use swoole to monitor whether the client is disconnected

$fd in swoole is the identifier of the TCP client connection, which is unique in the Server instance and will not be repeated in multiple processes.

Check whether the connection corresponding to fd exists.

function Server->exist(int $fd) : bool;

$fd returns true if the corresponding TCP connection exists, false if it does not exist

This interface is based on shared memory calculations and does not have any IO operations

Server->exist Available in version 1.7.18 or above

Recommended learning: swoole video tutorial

The above is the detailed content of How to use swoole to monitor whether the client is disconnected. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn