-
Notifications
You must be signed in to change notification settings - Fork 458
Open
Description
This was a recurring problem when publishing to mosquitto.
Probably the socket closes during the read function and the fread no longer blocks the loop or something.
while (!feof($this->socket) && $togo > 0) {
$fread = fread($this->socket, $togo);
$string .= $fread;
$togo = $int - strlen($string);
}
You need something like this:
$loops = 20;
while (!feof($this->socket) && $togo > 0) {
usleep(500);
$fread = fread($this->socket, $togo);
$loops--;
if(!$loops){return $string;}
$string .= $fread;
$togo = $int - strlen($string);
}
arthurdent75
Metadata
Metadata
Assignees
Labels
No labels