php socket 如何中断

WBOY
Release: 2016-06-13 11:54:44
Original
814 people have browsed it

php socket 怎么中断
我有php建个socket循环监听端口
while(true){
recv.....
}
现在麻烦了,这个页面F5重运行没效果了,端口一直被监听
我改的代码效果出不来
得重启机器才行
哇,每次都得这样,这样调试太麻烦啦

------解决方案--------------------
那你不处理监听的内容吗?

------解决方案--------------------
问题不清晰
理论上在while内捕捉一个条件,当满足是就break然后close就可以了
至于缓存问题这个比较怪,socket怎么会收到旧信息?
网页做这种内容时一般要设定即时过期(不缓存)以及自动刷新
------解决方案--------------------
你可以用 cli 模试调试呀

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!