189 8069 5689

php使用socket

  1. 服务端(server.php):
  2. 客户端(client.php):
    服务器失败");
    while($buf = socket_read($socket, 2048)){
    echo "从服务端接收到消息:$buf".PHP_EOL;
    while($data = trim(fgets(STDIN))){
        socket_write($socket, $data, strlen($data));
    }
    }
    socket_close($socket);

文章标题:php使用socket
标题链接:http://cdxtjz.cn/article/iedjgo.html