thedudeguy / PHP-Minecraft-Rcon

Simple Rcon class for php.
MIT License
155 stars 54 forks source link

unpack(): Type V: not enough input, need 4, have 0 #35

Open UndercoverNL opened 3 years ago

UndercoverNL commented 3 years ago

I am using this code on a Laravel based system

        $rcon = new Rcon('ip, port, 'password', 1);
        if ($rcon->connect())
        {
            Log::info('connected');
            $rcon->sendCommand("say Hello World!");
        } else {
            Log::info('disconected');
        }

but if ($rcon->connect()) returns me the error unpack(): Type V: not enough input, need 4, have 0 which comes from

        $size_data = fread($this->socket, 4);
        $size_pack = unpack('V1size', $size_data);

But when I log all the variables inside the vendor src file, it does log the right info provided in the new Rcon.