久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      swoole客戶端有什么用

      swoole客戶端有什么用

      client客戶端

      Client提供了TCP/UDP socket的客戶端的封裝代碼,使用時(shí)僅需 new SwooleClient 即可。

      除了普通的同步阻塞+select的使用方法外,Client還支持異步非阻塞回調(diào)。 (推薦學(xué)習(xí): swoole視頻教程)

      同步阻塞客戶端,示例代碼

      $client = new swoole_client(SWOOLE_SOCK_TCP);  if (!$client->connect('127.0.0.1', 9501, -1)) {     exit("connect failed. Error: {$client->errCode}n"); }  $client->send("hello worldn");  echo $client->recv();  $client->close();

      異步非阻塞客戶端,示例代碼

      $client = new SwooleClient(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC); $client->on("connect", function(swoole_client $cli) {     $cli->send("GET / HTTP/1.1rnrn"); }); $client->on("receive", function(swoole_client $cli, $data){     echo "Receive: $data";     $cli->send(str_repeat('A', 100)."n");     sleep(1); }); $client->on("error", function(swoole_client $cli){     echo "errorn"; }); $client->on("close", function(swoole_client $cli){     echo "Connection closen"; }); $client->connect('127.0.0.1', 9501);

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)