serverstf / python-valve

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

Are non-source servers supported? ServerQuerier (Mordhau timeout) #75

Open NotTrying opened 5 years ago

NotTrying commented 5 years ago

Ive got both source and non-source servers to work but cant get any Mordhau servers to work, Another game I have tried and failed to get any responses from is Warband. They all time out?

Can we only work with source servers and just get lucky on some non-source servers working (like Squad)? Or is something else going on? For example Squad works fine, which I believe is the same engine as Mordhau (EU4).

Anyone have any ideas how I can get these other game servers working? Thanks!

Code

import valve.source.a2s
SERVER_ADDRESS = ('147.135.6.200', 7779)
with valve.source.a2s.ServerQuerier(SERVER_ADDRESS, timeout=5) as server:
    info = server.info()
    players = server.players()

print("{player_count}/{max_players} {server_name}".format(**info))
for player in sorted(players["players"],
                     key=lambda p: p["score"], reverse=True):
    print("{score} {name}".format(**player)) 

Error

Traceback (most recent call last):
  File "../test.py", line 4, in <module>
    info = server.info()
  File "..\valve\source\a2s.py", line 140, in info
    return messages.InfoResponse.decode(self.get_response())
  File "..\valve\source\a2s.py", line 33, in get_response
    data = valve.source.BaseQuerier.get_response(self)
  File "..\valve\source\__init__.py", line 78, in wrapper
    return function(self, *args, **kwargs)
  File "..\valve\source\__init__.py", line 121, in get_response
    raise NoResponseError("Timed out waiting for response")
valve.source.NoResponseError: Timed out waiting for response
Yepoleb commented 5 years ago

If the game is supported by the Steam server browser it is supported by this library as well, but that doesn't seem to be the case for the games you mentioned.

TirianAzter commented 4 years ago

I'm able to get this to work for Mordhau. Your query port is mostly likely wrong, that looks like a game port, try 27015 (the default)