diff --git a/.travis.yml b/.travis.yml index 90e8fde..6fcd103 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ php: branches: only: - /^dev-.*$/ - - phpunit-support before_install: - travis_retry composer self-update diff --git a/src/ModbusSocket.php b/src/ModbusSocket.php index a1fa61a..479155b 100644 --- a/src/ModbusSocket.php +++ b/src/ModbusSocket.php @@ -150,14 +150,15 @@ class ModbusSocket $read = array($this->streamSocket); $write = null; $except = null; + $data = ''; if (false !== stream_select($read, $write, $except, $readTimeout['sec'], $readTimeout['usec'])) { $this->statusMessages[] = 'Wait data ... '; if (in_array($this->streamSocket, $read, false)) { - $data = fread($this->streamSocket, 2048); // read max 2048 bytes + $data .= fread($this->streamSocket, 2048); // read max 2048 bytes if (!empty($data)) { $this->statusMessages[] = 'Data received'; - return $data; //FIXME what if we are waiting for more than that? + return $data; } $lastAccess = microtime(true); } else {