Uncaught-Exceptions / MCRcon

Use minecraft's new-fangled Rcon
Other
52 stars 12 forks source link

struct.error: unpack requires a buffer of 8 bytes #23

Open m3dus444 opened 4 months ago

m3dus444 commented 4 months ago

Hi @aladras,

I'm using Windows 10 (10.0.19045 build 19045) and a Minecraft Forge 47.3 server. MCRcon is 0.7.0 version. I did all the server config to accept RCON. While following your exemple usage i'm stuck at very first exemple, MCRcon.py cannot connect to the server due to a struct function.

I'll try to fix the problem but in the meantime i'm opening this issue.

Here's the whole trackeback :

Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "C:\Users\user\curseforge\minecraft\Instances\Earthians\playground\scripts\autoforgegen.py", line 28, in check_player_count with MCRcon(RCON_IP, RCON_PASSWORD) as mcr: File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\mcrcon.py", line 57, in enter self.connect() File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\mcrcon.py", line 78, in connect self._send(3, self.password) File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\mcrcon.py", line 112, in _send in_id, in_type = struct.unpack("<ii", in_payload[:8]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ struct.error: unpack requires a buffer of 8 bytes

Thanks, m3dus444.

m3dus444 commented 4 months ago

Update : For whoever has the same issue : if you are running your server on a SaaS Hosting Provider (such as BisectHosting, Hosterfy etc) make sure you change the default port given by the provider to one of your allocated ports (or create the corresponding one). I didn't know but they won't give by default the right port. If you are running your own server, make sure the port is open in the firewall of your machine.

I close this issue now.