Skip to content

Commit

Permalink
Do not use MSG_DONTWAIT flag for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklul committed Jun 17, 2021
1 parent 9256ae1 commit ecf11f9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,10 @@ public function read($length = 1000)
throw new InvalidArgumentException('Length must be a NUMBER');
}

// https://bugs.php.net/bug.php?id=48326
if (!defined('MSG_DONTWAIT')) {
define('MSG_DONTWAIT', 0x20);
}

$this->buffer = '';
$len = 0;

while ($recvLen = @socket_recv($this->socket, $buffer, $length, MSG_DONTWAIT)) {
while ($recvLen = @socket_recv($this->socket, $buffer, $length, 0)) {
$this->buffer .= $buffer;
$bufferEnd = substr($buffer, -10);

Expand Down

0 comments on commit ecf11f9

Please sign in to comment.