serverstf / python-valve

A Python Interface to various Valve products and services
Other
236 stars 71 forks source link

rcon against local ark server times out #60

Open Hr46ph opened 6 years ago

Hr46ph commented 6 years ago

I'm actually just learning Python. I'm trying out different things with python-valve.

Basically, just copy/pasted this and adjusted it for my own server from this page: https://python-valve.readthedocs.io/en/latest/rcon.html

#!/usr/bin/python

import valve.rcon

address = ("1.2.3.4", 27020)
password = "myadminpassword"

with valve.rcon.RCON(address, password, timeout=30) as rcon:
    response = rcon.execute("broadcast Hello, world!")
    print(response.text)

The firewall on my server is open, I can telnet to the RCON port (specified on the command line and in the game ini file.

I am using battlemetrics.com using the same port on the public IP address (forwarded from the router) which just works.

When I change the port to the incorrect port, I immediately get a 'connection refused'. When I change the IP address, it never connects. When I change the password to be incorrect, it actually tells me the password is wrong.

It connects, authenticates, but the command is never executed.

Any ideas please?

Thanks.

AngellusMortis commented 6 years ago

As a note for this, it works in SourceRcon.py (which it looks like most of the Source RCON Python code came from), but that only supports Python 2.

I am now trying to investigate the difference between the two, but I am not the best at low level netcode.

AngellusMortis commented 6 years ago

Looks like the issue is that ARK does not support Multiple-packet responses.

I have made a change on my personal github that adds a new option for RCON to disable it from trying to except these type of responses. I will use for now and I may get around to adding proper unit tests and making a pull request in the following days.

I also made a Bug post on the official ARK forums: https://survivetheark.com/index.php?/forums/topic/279275-rcon-does-not-support-multiple-packets-responses/