03 2022 档案

摘要:swoole单socket多读多写实现思路 方式一 利用通道的阻塞效果达成同一时刻只有一个协程能够访问到socket效果 # 伪代码 use Swoole\Coroutine; use Swoole\Coroutine\Channel; use function Swoole\Coroutine\r 阅读全文
posted @ 2022-03-12 23:50 alwayslinger 阅读(195) 评论(0) 推荐(0)
摘要:使用streamwrapper进行自定义解包封包 streamWrapper class stream wrapper和filter的关系:stream wrapper能够使resource流化,比如http://www.baidu.com/index.php,php内置的http stream w 阅读全文
posted @ 2022-03-06 21:40 alwayslinger 阅读(144) 评论(0) 推荐(0)
摘要:php中user_filter的使用 golang中io库提供了统一的流操作方法,php中存在类似功能吗?答案是有的,并且同golang相似地提供了统一的操作流(网络、 文件、压缩数据等数据的抽象)的方法。也就是说php的流函数提供了处理不同流资源的统一接口。 流数据各式各样,针对不同的流自然需要不 阅读全文
posted @ 2022-03-05 23:06 alwayslinger 阅读(119) 评论(0) 推荐(0)
摘要:PHP守护进程demo <?php class Daemon { private Closure $call; public function __construct(Closure $call) { $this->call = $call; $this->prepareDaemon(); } pr 阅读全文
posted @ 2022-03-04 14:59 alwayslinger 阅读(68) 评论(0) 推荐(0)