diff --git a/src/Socket/SwooleSocket.php b/src/Socket/SwooleSocket.php index 4711efd..71e9a22 100644 --- a/src/Socket/SwooleSocket.php +++ b/src/Socket/SwooleSocket.php @@ -128,7 +128,7 @@ public function recv(int $length, ?float $timeout = null): string $leftTime = $timeout; while ($this->socket && !isset($this->receivedBuffer[$length - 1]) && (-1 == $timeout || $leftTime > 0)) { $buffer = $this->socket->recv($timeout); - if (false === $buffer) { + if ($buffer === '' || $buffer === false) { throw new SocketException(sprintf('Could not recv data from stream, %s [%d]', $this->socket->errMsg, $this->socket->errCode)); } $this->receivedBuffer .= $buffer;