-
Notifications
You must be signed in to change notification settings - Fork 20
SourceQuery
frostschutz edited this page Sep 14, 2010
·
1 revision
SourceQuery implements the Source Server Query protocol as described here: Server_Queries
Currently it supports ping, info, player, and rules queries.
Split responses (on 32+ players servers or games with lots of rules) are handled correctly. Incomplete responses by buggy implementations of some games (Team Fortress 2) are gracefully handled without raising an error. According to the specifications, the response may be bzip2 compressed. This is not implemented yet because I could not find any game that actually does this.
Since UDP is a connectionless protocol, a new socket with a random local client port is created for every query. This is to avoid some quirks such as servers sending additional packets we didn’t expect.
Example usage:
import SourceQuery server = SourceQuery.SourceQuery('1.2.3.4', 27015) print server.ping() print server.info() print server.player() print server.rules()