Home  >  Article  >  Backend Development  >  php怎么保持与C++的socket一直连接?如果检测socket已经连接上

php怎么保持与C++的socket一直连接?如果检测socket已经连接上

WBOY
WBOYOriginal
2016-06-13 12:03:071083browse

php如何保持与C++的socket一直连接?如果检测socket已经连接上?
我现在与C++底层通信用socket,但是如何一直保持连接?我下次检测到此socket已经连接后直接收发信息,如何实现?请高手指点下,请附代码,谢谢!!!
------解决方案--------------------
去看下swoole的扩展
------解决方案--------------------
你这些workerman已经给你做好了。
把workerman下载下来,自己实现下 Event.php中的三个方法就好了
onConnect 当C++的连接时你要做什么
onMssage 当C++的连接上有消息过来你要做什么
onClose  当C++的连接断开时你要做什么 

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