Home  >  Article  >  Backend Development  >  apache+fastcgi+php模式,怎样实现socket长连接,象mysql_pconnect函数这样解决办法

apache+fastcgi+php模式,怎样实现socket长连接,象mysql_pconnect函数这样解决办法

WBOY
WBOYOriginal
2016-06-13 10:14:18757browse

apache+fastcgi+php模式,怎样实现socket长连接,象mysql_pconnect函数这样
apache+fastcgi+php模式,怎样实现socket长连接,象mysql_pconnect函数这样

------解决方案--------------------
socket 不存在连接长短问题,只要你不断开,就一直连接着(网络故障、掉电、当机除外)
apache+fastcgi+php 下的 php 的生存周期是一个 HTTP 会话,所以由 php 发起的 socket 随 php 进程结束而结束

当然 php 也提供了 pfsockopen 供你使用

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