zoukankan      html  css  js  c++  java
  • swoole tcp连接

    <?php
    
    $serv= new swoole_server("0.0.0.0",9501);
    /*
     $serv->on(string $event,mixed $callbank)
     $event:  connect:建立连接 
                        $serv:服务器信息; $fd : 客户端信息
              receive:当接受到数据
                        $serv:服务器信息; $fd : 客户端信息
                        $from_id :id ,$data:数据
                        
              close:关闭,链接
    
    */
    $serv->on('connect',function($serv,$fd){
        
        echo "建立连接
    ";
        
    });
    $serv->on('receive',function($serv,$fd,$from_id ,$data){
        
        echo "收到数据
    ";
        
    });
    
    $serv->on('close',function($serv,$fd){
        
        echo "关闭
    ";
    });
    
    $serv->start();
    ##########################################################################

    1,上传代码到服务器,
    2 切换到站点目录
       

    3 运行

      

    4 查看是否运行

    我们可以在Shell里运行,使用pstree查看进程模型结构: 

    [root@root ftpname]# pstree -ap|grep index.php
    | | `-php,4058 index.php
    | | |-php,4059 index.php
    | | | |-php,4062 index.php
    | | | |-php,4063 index.php
    | | | |-php,4064 index.php
    | | | `-php,4065 index.php
    | |-grep,4067 --color=auto index.php
    [root@root ftpname]#

     4 关闭防火墙; 开启服务

    5  测试





    ##########################################################################





  • 相关阅读:
    Flexbox 可视化属性
    latex 数学公式
    迭代器模式 rx 应用
    小程序开发 easy-less 配置
    react-devtool 消息处理渲染 源码理解
    csrf jsonp
    koa1 源码详解1
    Immutable api example
    es6 ajax
    lodash 替换 underscore
  • 原文地址:https://www.cnblogs.com/benpaodegegen/p/10208954.html
Copyright © 2011-2022 走看看