src/HSPHP/ReadSocket.php
protected function sendStr($string)
    {
        if (!$this->isConnected()) {
            throw new IOException('No active connection');
        }

        $string = (string)$string;
        while ($string) {
            $bytes = @fwrite($this->socket, $string);
            if ($bytes === false) {
                $this->disconnect();
                throw new IOException('Cannot write to socket');
            }

            if ($bytes === 0) {
                return;
            }
            $string = substr($string, $bytes);
        }
    }
protected function sendStr($string)
    {
        if (!$this->isConnected()) {
            throw new IOException('No active connection');
        }

        $string = (string)$string;
        while ($string) {
            $bytes = @fwrite($this->socket, $string);
            if ($bytes === false) {
                $this->disconnect();
                throw new IOException('Cannot write to socket');
            }

            if ($bytes === 0) {
                return;
            }
            $string = substr($string, $bytes);
        }
    }
Send command to server

@param string $string

@throws IOException