Skip to content

Issues with DayZ RCon #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fugma313 opened this issue May 25, 2024 · 7 comments
Open

Issues with DayZ RCon #32

fugma313 opened this issue May 25, 2024 · 7 comments

Comments

@fugma313
Copy link

fugma313 commented May 25, 2024

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
Copy link
Owner

conqp commented May 25, 2024

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.

@Blenderpics
Copy link

I can confirm that the the library indeed looses connection frequently to the BE server, so you need to manually reconnect the client.

@conqp
Copy link
Owner

conqp commented Oct 15, 2024

I am not sure that I understand the original issue.

The log messages you see come from the RCon server and afaik are always logged when a remote RCon command is executed.
Since this is a property of DayZ's BE RCon server, there's nothing I can do about that.

Can you maybe share the full script you're using so that I may try to reproduce it (I'm running a DayZ server myself).

@Blenderpics
Copy link

The RCon Client basically looses connection immediately after you connected to the server.
The connection isn't held up.
Which means you need to perform a login for every command you want to execute.
This results in the server log beeing spammed with login messages (which is not the main issue, as far as i am concerned)

The BE Client should keep the connection alive by sending the correct ACK packages.

I haven't debugged the network traffic myself, but what i understand based on @fugma313 's comment is that your client isn't working correctly.
For server messages, which need to be acknowledged by sending 'B'(0x42) | 'E'(0x45) | 0x02, your client is only sending 0x02.
The BE RCON specification states that server messages that are not correctly acknowledged will result in the connection beeing droped, which is what seems to be happening here.

@Blenderpics
Copy link

To further elaborate: A BE Client login event will trigger a Server Message that gets broadcasted to all connected clients, containing the same string that lands in the server log (RCon admin #0 (127.0.0.1:52368) logged in)

Since that message is not acknowledged correctly, the client will be disconnected quickly after it authenticated.

@conqp
Copy link
Owner

conqp commented Oct 17, 2024

For server messages, which need to be acknowledged by sending 'B'(0x42) | 'E'(0x45) | 0x02, your client is only sending 0x02.

Thank you for pointing out this bug.

Can you please check, whether f88f9db fixes this issue?

@conqp
Copy link
Owner

conqp commented Oct 17, 2024

Hotfix in 41e0b6b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants