Official Soldat Forums

Server Talk => Server Discussion => Topic started by: machina on April 25, 2016, 11:29:31 am

Title: Request server's details
Post by: machina on April 25, 2016, 11:29:31 am

Web lobby ( uses such request to get informations about currently running servers:`c=all`v=all`bots=all`locked=all`r=all`s=all`a=all`w=all`os=all`pl=all`namedItem=undefined`item=undefined`undefined=undefined (`c=all`v=all`bots=all`locked=all`r=all`s=all`a=all`w=all`os=all`pl=all`namedItem=undefined`item=undefined`undefined=undefined).

My question is if there's any possibility to query for informations about a specific server - not all of them. So I would have a request like that (for example):
Code: [Select]
Yea, I could query everything and search for the desired server but I wonder if there are extra possibilities.

And one would return JSON for that ip and port i.e.:
Code: [Select]
Also, if there is a way to query for more data than currently it is available with above request? Names of players those are playing on server for example.

Hopefully, I'm not asking something that was already answered elsewhere.

Title: Re: Request server's details
Post by: soldat-game on April 25, 2016, 11:34:18 am
No  ;)
Title: Re: Request server's details
Post by: Falcon` on April 25, 2016, 11:39:18 am
You can download server's gamestats.txt via map port using soldat's file protocol. This would solve both of your issues (only one server, more data).

EDIT: More info here (
Title: Re: Request server's details
Post by: jrgp on April 25, 2016, 02:24:00 pm
We could theoretically make such a json api for the lobby, but as falcon said you can just read gamestat.txt and parse that. Or parse refresh/refreshx if you have rcon access.
Title: Re: Request server's details
Post by: machina on April 26, 2016, 09:33:26 am
Ugh, dunno what I'm doing incorrectly but I can't get that gamestat.txt file downloaded. I increased the port by 10 as it is said here ( Then, I tried to get file with such request from the browser's address directly so it's HTTP GET (maybe that's wrong idea):
Code: [Select] probably my mistake has very simple solution but so I'm no more stuck and I don't have much time for digging I decided to ask you, guys :)

Btw. I'm not perfectly aware if this server has set Allow_Download=1 but I assumed that because this is a default value for Soldat.ini config file.
Title: Re: Request server's details
Post by: machina on April 27, 2016, 11:18:17 am
Okay! I got it working. Thanks for help, people ;)

This php script will show you players count on server:
Nice you wrote this snippet for me. I must admit though I abandoned using PHP in high school and currently I work only in Node :)

EDIT: I'm facing kind of issue that there is only the following text returned (and maybe some \r\n) instead of full information:
It seems to happen randomly like there was kind of delay time between possibility to download gamestat.txt. I can get the full information only from time to time but most calls fail.

EDIT2: Now I could download data twice within 10 sec but later every call fails till 80 secs passes. Very random. Not sure if my script or Soldat's server's fault  :-\