- //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Sending out ' . strlen($encodedData) . ' bytes,bufferSize=' . $bufferSize . ',diff=' . $this->diff);
- $sentBytes = @socket_write($socketResource, $encodedData, ($bufferSize - $this->diff));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: Sending out ' . strlen($encodedData) . ' bytes,bufferSize=' . $bufferSize . ',diff=' . $this->diff);
+
+ if ($this->diff >= 0) {
+ // Send all out (encodedData is smaller than or equal buffer size)
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: MD5=' . md5(substr($encodedData, 0, ($bufferSize - $this->diff))));
+ $sentBytes = socket_write($socketResource, $encodedData, ($bufferSize - $this->diff));
+ } else {
+ // Send buffer size out
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: MD5=' . md5(substr($encodedData, 0, $bufferSize)));
+ $sentBytes = socket_write($socketResource, $encodedData, $bufferSize);
+ }