Windows 版本 TcpConnection 出现错误

ztj7157
$command = 'ping www.baidu.com';
$connection->process_handle = popen($command, 'r');
    if ($connection->process_handle) {
        $process_connection = new TcpConnection($connection->process_handle);
        $process_connection->onMessage = function ($process_connection, $data) use ($connection, $connection_count) {
            $connection->send($connection_count . ':::::::' . $data);
        };
        $process_connection->onClose = function ($process_connection) use ($connection) {
            $connection->close();
        };
    }

如下错误:

Warning: fread(): supplied resource is not a valid stream resource in D:\workerman-for-win\Connection\TcpConnection.php on line 369

Warning: feof(): supplied resource is not a valid stream resource in D:\workerman-for-win\Connection\TcpConnection.php on line 373

在 linux 版本上正常。

2734 1 0
1个回答

walkor

打印下 popen($command, 'r'); 返回值,应该是popen返回了false。

  • 暂无评论
年代过于久远,无法发表回答
🔝