conqp / rcon

Python RCON client library
GNU General Public License v3.0
81 stars 15 forks source link

Issues with DayZ RCon #32

Open fugma313 opened 2 months ago

fugma313 commented 2 months ago

I use this module to keep a local player database in a text file, among other things.

Here's some of the code

while True:
    try:
        with Client(rcon_server_address, int(rcon_server_port), passwd=rcon_server_password, timeout=5) as client:
            print(f"Connected to the DayZ server at {rcon_server_address}:{rcon_server_port}")
            while True:

                response = client.run("players")
                if len(response) < 1: # If this is removed, we forever transmit without a reply...
                    raise Exception("Disconnected")
                lines = response.split("\n")
                for line in lines:
                    if "." in line and ":" in line: 
                    ...

If I don't raise that exception, I will forever transmit the "players" command which will be ignored by the RCon server.

Judging by the network traffic, something is wrong. The server sends "RCon admin #0 (IP:port) logged in", and I see a reply of b'0200', but this doesn't seem to be what the RCon server is expecting. Because it will transmit this same login message up to 5 times, after which it will start ignoring any commands sent to it, forcing me to re-auth with RCon to continue executing commands. This is becoming a problem as my DayZ server console is flooded with "BattlEye Server: RCon admin #0 (127.0.0.1:52368) logged in"

Edit: Upon comparing the network traffic between this and DaRT, it looks like the reply (0200) is missing the BE RCon protocol header.

conqp commented 2 months ago

Thanks for the report. I'm currently on vacation for the next two weeks, so I cannot work on this before 2024-06-03. I will try to reproduce this asap after that and provide a fix if applicable.