$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 版本上正常。
打印下 popen($command, 'r'); 返回值,应该是popen返回了false。