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()
When trying to connect to a Minecraft server hosted on a local network, I get the following error:
The port is correct, the hostname is correct and there is nothing wrong with password.
This is using the code provided in the example: