Home  >  Article  >  Backend Development  >  php 怎么判断client socket断开

php 怎么判断client socket断开

WBOY
WBOYOriginal
2016-06-06 20:23:072378browse

php 怎么判断client socket断开

回复内容:

php 怎么判断client socket断开

当连接断开时,读写socket的函数会失败。如socket_read()在读取失败时布尔值false。这时可以调用socket_last_error()和socket_strerror()函数得到错误代码和错误信息。可以根据这个判断失败原因是否为连接断开。

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