PHP脚本可以检测套接字是否已关闭?
发布时间:2020-12-13 17:01:51 所属栏目:PHP教程 来源:网络整理
导读:如何通过远程方检测套接字是否为 closed,PHP脚本如何检测? 解决方法 从 socket_read()开始: socket_read() returns the data as a string on success,or FALSE on error (including if the remote host has closed the connection). The error code can be
如何通过远程方检测套接字是否为
closed,PHP脚本如何检测?
解决方法
从
socket_read()开始:
socket_read() returns the data as a string on success,or FALSE on error (including if the remote host has closed the connection). The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual representation of the error. 这是检测套接字是否在大多数语言中关闭的相当标准的方法.我不相信PHP会提供直接的事件样式通知(除了PEAR中的某些内容). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |