
swoole
紫沐星
Hello world!
展开
-
swoole UDP TCP客户端
WARNING swSocket_bind (ERROR 502): bind(127.0.0.1:9501) failed. Error: Address already in use提示接口已经被占用查看端口:netstat -anp | grep 9501 杀掉:kill 26679类似于nginx 这种服务<?php //连接 SWOOLE TCP服务$client = new ...原创 2018-04-25 15:07:56 · 1228 阅读 · 0 评论 -
swoole 定时器
https://wiki.swoole.com/wiki/page/244.htmlswoole_timer_tick 间隔多久运行一次 多次swoole_timer_after 多久之后运行一次 单次swoole_timer_clear 使用定时器ID来删除定时器。function onOpen($server, $request){ print_r($request->fd);...原创 2018-05-31 15:03:09 · 1055 阅读 · 0 评论 -
swoole task任务
https://wiki.swoole.com/wiki/page/41.html<?phpclass wsServer{ const Host = '0.0.0.0'; const PORT = '9504'; public $ws = null; function __construct() { $this->ws =...原创 2018-05-30 17:28:48 · 1558 阅读 · 0 评论 -
swoole 总结
TCP UDPhttps://blog.youkuaiyun.com/zimuxin/article/details/80022420https://blog.youkuaiyun.com/zimuxin/article/details/80079051一个服务端,可分配多个 worker进程,让客户端调用HttpServerhttps://blog.youkuaiyun.com/zimuxin/article/details/80...原创 2018-06-05 14:26:00 · 2073 阅读 · 0 评论 -
swoole 协程coroutine
https://wiki.swoole.com/wiki/page/576.html协程redis 同步代码实现异步IO的操作<?php/** * Created by PhpStorm. * User: whitneywang * Date: 2018/6/4 * Time: 16:10 */$http = new swoole_http_server('0.0.0.0',...原创 2018-06-04 18:06:24 · 1687 阅读 · 0 评论 -
swoole 内存Memory
1.table https://wiki.swoole.com/wiki/page/256.html<?php/** * Created by PhpStorm. * User: whitneywang * Date: 2018/6/4 * Time: 15:43 *///创建内存表$table = new swoole_table(1024);//内存添加一列$ta...原创 2018-06-04 16:05:33 · 1127 阅读 · 0 评论 -
swoole process进程 多分发
<?php/** * Created by PhpStorm. * User: whitneywang * Date: 2018/6/4 * Time: 14:14 *///第二个参数为true时,不输出TODO里的输出内容,显示会放到管道中$process = new swoole_process(function (swoole_process $pro) { /...原创 2018-06-04 15:38:23 · 1574 阅读 · 0 评论 -
swoole 异步redis
1.安装redis忽视2.安装hiredis库https://wiki.swoole.com/wiki/page/p-redis.htmla. wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gzb. tar -zxvf v0.13.3.tar.gz c. cd hiredis-0.13.3/d. make -je. make...原创 2018-06-04 14:07:02 · 1609 阅读 · 0 评论 -
swoole websocket服务
websocket协议是基于TCP的一种新网络协议,它实现了浏览器与服务器全双工(full-duplex)通信--可以让服务器主动发送信息给客户端为什么用websocketHTTP的通信只能由客户端发起,比如ajax轮寻啊websocket特点:1.建立在TCP协议之上2.性能开销小通信高效3.客户端可以与任意服务器通信4.协议标识符WS WSS跟HTTPS一个概念5.持久化网络通信协议 服务器主...原创 2018-04-25 18:40:37 · 1517 阅读 · 0 评论 -
SWOOLE httpserver
目前PHP项目基本上都是HTTP server ,nginx 代理转发$http = new swoole_http_server("0.0.0.0", 9503);//设置静态资源$http->set([ 'enable_static_handler' => true, 'document_root' => '/home/demo/data' //静态资源...原创 2018-04-25 17:12:59 · 1064 阅读 · 0 评论 -
swoole丝袜
swoole是PHP的异步、并行、高性能网络通信引擎,使用纯C语言编写,提供了PHP语言的异步多线程服务器,异步TCP/UDP网络客户端,异步MySQL,异步Redis,数据库连接池,AsyncTask,消息队列,毫秒定时器,异步文件读写,异步DNS查询。 Swoole内置了Http/WebSocket服务器端/客户端、Http2.0服务器端。除了异步IO的支持之外,Swoole为PHP多进程的模...原创 2017-12-07 14:19:01 · 1201 阅读 · 0 评论 -
源码编译安装 swoole
https://gitee.com/swoole/swoole/tree/v2.1.2git下载源码git clone https://gitee.com/swoole/swoole.git利用phpize bin目录下1、phpize是干嘛的?phpize是什么东西呢?php官方的说明:http://php.net/manual/en/install.pecl.phpize.phpphpize是...原创 2018-04-20 18:10:29 · 2621 阅读 · 0 评论 -
swoole TCP UDP server
https://wiki.swoole.com/TCP<?php/** * Created by PhpStorm. * User: whitneywang * Date: 2018/4/20 * Time: 18:21 *///创建Server对象,监听 127.0.0.1:9501端口$serv = new swoole_server("127.0.0.1", 9501...原创 2018-04-20 19:13:09 · 515 阅读 · 0 评论 -
swoole 异步系统文件IO
https://wiki.swoole.com/wiki/page/183.html原创 2018-05-31 15:16:19 · 283 阅读 · 0 评论