zoukankan      html  css  js  c++  java
  • MeepoPS基本使用方法

    MeepoPS基本使用

      

      MeepoPS是Meepo PHP Socket的缩写. 旨在提供高效稳定的由纯PHP开发的多进程SocketService。
      MeepoPS可以轻松构建在线实时聊天, 即时游戏, 视频流媒体播放, RPC, 以及原本使用HTTP的接口/定时任务的场景中等。


    (1)MeepoPS的最低运行要求是安装了PHP的PCNTL库,检查php是否安装了PCNTL库。


    (2)下载socket:

      sudo apt-get install socket


    (3)下载MeepoPS的demo:

      https://github.com/lixuancn/MeepoPS/archive/master.zip

      解压传输到linux服务器上。


     (4)进入到解压后的目录

      修改demo-telnet.php的主机地址为127.0.0.1,端口为8080。

      执行:sudo php demo-telnet.php start

    test@localhost:/wwwroot/meepoPS$ sudo php demo-telnet.php start
    MeepoPS Start:                         [OK]
    -------------------------- MeepoPS Start Success ------------------------
    MeepoPS Version: 0.0.5 | PHP Version: 5.3.10-1ubuntu3.26 | Master Pid: 4556 | Event: Select
    -------------------------- Instances List -------------------------
    MeepoPS-Telnet  telnet://127.0.0.1:8080  Child Process: 1

    再开启一个窗口,然后使用ps aux | grep php,可以看到已经启动成功:

    test@localhost:~$ ps aux | grep php
    root       4310  0.0  0.2  58488  2196 pts/1    S+   15:48   0:00 sudo php demo-telnet.php start
    root       4311  0.0  1.1 248236 11372 pts/1    S+   15:48   0:00 php demo-telnet.php start
    root       4313  0.0  0.5 248236  5804 pts/1    S+   15:48   0:00 php demo-telnet.php start
    test       4522  0.0  0.0  11728   972 pts/3    S+   15:51   0:00 grep --color=auto php

      连接:

      telnet 127.0.0.1:8080

      

    test@localhost:/wwwroot/meepoPS$ telnet 127.0.0.1:8080
    telnet: could not resolve 127.0.0.1:8080/telnet: Name or service not known
    test@localhost:/wwwroot/meepoPS$ telnet 127.0.0.1 8080
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.

      然后就可以发消息,两个窗口都可以收到。


     http 方式

       修改demp-http.php文件:

      $http = new MeepoPSApiHttp('0.0.0.0', '8080');
      $http->setDocument('127.0.0.1:8080','/wwwroot/MeepoPS/');

      保存退出,启动demo-http.php(如果有错误,可以使用:set nu 显示行号进行调试)


      

  • 相关阅读:
    项目ITP(五) spring4.0 整合 Quartz 实现任务调度
    [Git 系列] WIN7下Git的安装
    Candy
    OSGI
    JAVA编程思想(1)
    [python] 字典和列表中的pop()函数
    R语言编程语法
    Linux 之创建工作目录-mkdir
    python 之 改变工作目录
    python 之 'and' 和 'or'
  • 原文地址:https://www.cnblogs.com/gyfluck/p/9354985.html
Copyright © 2011-2022 走看看