Iapetus-11 / aio-mc-rcon

An asynchronous RCON client/wrapper for Minecraft Java Edition
MIT License
38 stars 4 forks source link

Issue connecting to server due to buffer #6

Closed TheLostProgrammer closed 10 months ago

TheLostProgrammer commented 1 year ago

When trying to connect to a Minecraft server hosted on a local network, I get the following error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
    await self.coro(*args, **kwargs)
  File "/Users/user/Documents/pythonProject/led.py", line 169, in player_count
    await rcon_client.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiomcrcon/client.py", line 58, in connect
    await self._send_msg(MessageType.LOGIN, self.password)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiomcrcon/client.py", line 79, in _send_msg
    in_len = struct.unpack("<i", (await self._reader.read(4)))[0]
struct.error: unpack requires a buffer of 4 bytes

The port is correct, the hostname is correct and there is nothing wrong with password.

This is using the code provided in the example:

rcon_client = Client(host_name, rcon_port, rcon_password)
try:
    await rcon_client.connect()
except aiomcrcon.RCONConnectionError:
    print("An error occurred whilst connecting to the server...")
    return
except aiomcrcon.IncorrectPasswordError:
    print("The provided password was incorrect...")
    return

try:
    response = await rcon_client.send_cmd('/stop')
except aiomcrcon.ClientNotConnectedError:
    print("The client was not connected to the server for some reason?")
    return

print(response)

await rcon_client.close()
Iapetus-11 commented 1 year ago

I have released v3.2.1 which should address this, please let me know if it does or if you have any future issues

Iapetus-11 commented 10 months ago

Closing due to lack of response