library/Rediska/Connection/Socket.php
public function write($string) 
    {
        if ($string == '') {
            return false;
        }

        $this->connect();

        $string = (string)$string . Rediska::EOL;

        $offset = 0;
        $length = strlen($string);

        while (true) {
            $sent = @socket_write($this->getSocket(), substr($string, $offset, $length), $length);

            if ($sent === false) {
                $errorCode = socket_last_error();
                $errorMessage = socket_strerror($errorCode);

                // in nonblock mode  EAGAIN is OK
                if ($errorCode == 35) continue;

                $this->disconnect();

                throw new Rediska_Connection_Exception("Can't write to socket: " . $errorMessage);
            }

            $offset += $sent;
            $length -= $sent;

            if ($length <= 0) {
                return true;
            }
        }

        return true;
    }
public function write($string) 
    {
        if ($string == '') {
            return false;
        }

        $this->connect();

        $string = (string)$string . Rediska::EOL;

        $offset = 0;
        $length = strlen($string);

        while (true) {
            $sent = @socket_write($this->getSocket(), substr($string, $offset, $length), $length);

            if ($sent === false) {
                $errorCode = socket_last_error();
                $errorMessage = socket_strerror($errorCode);

                // in nonblock mode  EAGAIN is OK
                if ($errorCode == 35) continue;

                $this->disconnect();

                throw new Rediska_Connection_Exception("Can't write to socket: " . $errorMessage);
            }

            $offset += $sent;
            $length -= $sent;

            if ($length <= 0) {
                return true;
            }
        }

        return true;
    }
Write to connection stream

@param $string
@return bool
@throws Rediska_Connection_Exception