Talk:Master Server Query Protocol

From Valve Developer Community
Jump to: navigation, search

I don't see any effect when using "\\type\\d". I think it isn't used anymore for the Source protocol. --ViscountPherget 07:55, 12 Sep 2005 (PDT)

I really d0nt know... that's all I found for documentation... they really don't have much
1.2 IP:Port
Steam sends "0.0.0.0:0". 

Does anyone know what this is supposed to be the address of? 

Changing it doesn't appear to affect the results in anyway. 

(Should be the first IP address we are interested in.) 

I think it's the client's IP, coz the client IP is a big factor in what IP's are returned—ts2do 16:24, 21 Jan 2006 (PST)

That doesn't make sense to me, since the server can SEE your IP since that's part of the UDP protocol! Otherwise, how would it know who to send the server list to? :) My guess is it's just a dummy placeholder so the syntax doesn't change between the first and subsequent packets. --The MAZZTer 21:53, 27 Jun 2008 (PDT)

Filter on country

Hi !

Is there a way to filter game servers by countries instead of regions ? There's a tool doing it but I don't see it anywhere in the Master Server Query Protocol.--madfu

You can do it using the gameservers IPs, search google for IP to Country. --Scott Loyd

Thanks a lot ! I am writing a tool for discovering cstrike servers (sorry for bad english) and I found the web service IP-to-Country which can be queried directly by http (--madfu


Spectate

Why does proxy\1 return only one source server ? Even steam says it is only one.. But when checking the dedicated field which should be l or d - listen/dedicated, the source tv servers has the type p... proxy ? And there are a lot of servers which has type p. But they are not returned using proxy/1.. Broken ? And when trying to send this filter: type\p that doesnt work either. only type\d works. So there is no way of getting all the spectate servers without querying all servers and filter clientside... proxy\1 seems to be working on HL1 servers, at least it returns a lot of servers. —Dstructr

More Servers

I'm attempting to do this in PHP. I can get the first 231 servers..

		fwrite( $fp, "1", 1 );
		fwrite( $fp, $countrycode, 1 );
		fwrite( $fp, $startip, strlen($startip) );
		fwrite( $fp, 0, 1 );
		fwrite( $fp, $params, strlen($params) );
		fwrite( $fp, 0, 1 );

Where $startip is equal to "0.0.0.0:0" on the first run, then the last ip/port on the next one.. but it always seems to just return the first batch over and over again.. Am I doing it wrong?

- Garry 07:45, 16 Apr 2007 (PDT)

By looking at the documentation, I can't find any reason to use this:

		fwrite( $fp, 0, 1 );

I think you should try without it, or do as their sample, to get all servers in all games.

		fwrite( $fp, "1", 1 );
		fwrite( $fp, $countrycode, 1 );
		fwrite( $fp, $startip, strlen($startip) );
		fwrite( $fp, $params, strlen($params) );

Or:

		fwrite( $fp, "1", 1 );
		fwrite( $fp, $countrycode, 1 );
		fwrite( $fp, $startip, strlen($startip) );
		fwrite( $fp, 0, 1 );
		fwrite( $fp, 0, 1 );

And there isn't more than 231 GMod10 servers up, that might be the problem? --Sortie 00:04, 17 Apr 2007 (PDT)

I'm having the exact same problem with TF2 and Java, and I know there are more than 231 TF2 servers. It looks like the master server returns a maximum of 231 servers per request, as that's how many fit in a packet. Did you ever find out what was wrong, Garry? -BarkerJr 05:33, 7 Jan 2008 (PST)

I believe I have figured it out. If the request comes from a different port (which will most certainly happen if you close a socket and open a new one) the Master Server does not recognize your request as a continuing request, but a brand new one.

Solution: Don't close your socket after getting the first batch of IPs, keep it open until you have them all. --The MAZZTer 21:41, 27 Jun 2008 (PDT)

Getting serverlist from masterserver works, but...

hello out there,

i'm writing a gameserverbrowser for several online games, now i'm doing the souce quering part. Here my question: when i query: "hl1master.steampowered.com:27010" with "1ÿ0.0.0.0:0\x00\x00" and do all the neccesary reply stuff, i recieve 185 packets with 42592 servers-ips, doing the same on "hl2master.steampowered.com:27011" with "1ÿ0.0.0.0:0\x00\x00" i recieve 131 Packets with 30129 servers these are a lot of ip adresses to which game/games do they belong? As far as i have understud it, i have to use the filter field (between \x00\x00) in the querystring to filter out different games, so if i'm right i have t use "\\gamedir\\cstrike" to recieve only counterstrike ips, is that right? So how do i know what to use the get specific games, is there a list somewhere? How do i find out which filter is needed for which game?

hope you can help

Rob

Evidently, you should filter it with the gamedirectory—ts2do 09:02, 29 Apr 2007 (PDT)
The game directory is a short, internal name used by the game or mod. Counter-Strike uses cstrike, Half-Life uses valve (IIRC). You can figure it out by opening your Steam\SteamApps directory. For GoldSource/Source games and not mods, go into your account name directory, and then into the directory for the specific game. "bin", "errorlogs", "gldrv", "platform", are special directorties and not game directories... the rest are. Usually a game will have one, and then will have a directory with the "base" game name. (IE counter strike has "cstrike" and "valve", valve is the game directory name for Half-Life).
For Half-Life mods they each get a new game directory in your Half-Life folder which you can find using the directions above. Source Mods are in SteamApps\Sourcemods and the name of the directory is the name you want.
It is a bit complicated but that should be enough to help, sorry if it's confusing. --The MAZZTer 22:03, 27 Jun 2008 (PDT)

Master server response

I'm getting the following back from the master server when I attempt to register with it:

0000   FF FF FF FF 4F 21 7B 59    ....O!{Y
0008   60                         

Note the challenge in this case was 21 7B 59 60, so it appears to be some sort of success/failure code that isn't know. Anyone have any idea what this actually means? Devicenull 11:38, 13 Dec 2008 (PST)

4F byte means that your server is outdated, it is not new challenge. --Shift 18:24, 4 June 2011 (UTC)

No Response from hl2master.steampowered.com

I submitted a ticket to Valve to get this fixed. In the mean time, fetch an IP from C:\Program Files\Steam\config\MasterServers.vdf --BarkerJr

Valve's response is "If you are still seeing this issue, please use the other server IP's that are currently working properly." --BarkerJr
What I've done is created my own versions of the DNS, hl1master.barkerjr.net and hl2master.barkerjr.net, which I maintain my self, which is annoying. The problem with this, though, is that there are some servers with non-standard ports. Any ideas? --07:23, 19 January 2010 (UTC)
Thx BarkerJR, i had the same problem with my query tool, now i'm using your "hl2master.barkerjr.net" and it works fine

hl2master.steampowered.com

In response to people receiving no reply from hl2master.steampowered.com I created a ticket on the Steam website only to have Valve say they don't support 3rd party apps. Although I didn't mention anything about a 3rd party app and only that I couldn't get a response when trying to query hl2master.steampowered.com. If anyone has a solution/fix for this issue it would be greatly appreciated.

New Parameter: gametype

With Left 4 Dead version 10, several new parameters were added[1]. Some are obvious, but gametype needs some explanation. Some Examples:

\gametype\coop,sv_search_key_1010
\gametype\coop,sv_search_key_Yf1pLy1010

Anyone want to take a stab at documenting it? --BarkerJr 00:09, 14 March 2009 (UTC)

hl1master not responding?

Has anyone else been having trouble with hl1master.steampowered.com:27010 only replying a few times and then ceasing to give more results?

It seems that koraktor has this issue with Steam Condenser as of at least a few months ago (link). Apparently changing the port worked for a bit, but then that change was reverted as it no longer works.

The code I'm using works fine with hl2master (using to query both for an unfiltered list). Psychonic 16:45, 21 September 2010 (UTC)

It's working for me sending [49, -1, 48, 46, 48, 46, 48, 46, 48, 58, 48, 0, 92, 103, 97, 109, 101, 100, 105, 114, 92, 116, 102, 99, 0] to 72.165.61.190:27010 and getting back a bunch of tfc servers. --BarkerJr 02:15, 22 November 2010 (UTC)
Any update on this issue? I am still not able to query the GoldSrc master server (using Steam Condenser). Other users experience the same although I know it worked a few weeks ago. --Koraktor 22:30, 25 August 2011 (PDT)

Source Engine/TF2 master server 'join procedure' no longer using simple UDP?

I've been attempting to write a proxy server for SRCDS which is supposed to answer source engine queries, filter unwanted traffic and reroute any other traffic to the real srcds. However, it seems that joining the master list now happens using the TCP protocol and all data inside it is obfuscated in some way to make it unreadable. This means that I can't let my proxy program join the hl2 master servers because I don't know how the required packets to do that are constructed.

Does anyone have any more insight in how to get third party applications to join the master server list? --Maurits150 04:59, 4 May 2012 (PDT)

i got some data packets by using wireshark.the packet starting with 'VS01' sends to three or more Master servers,like this

0000   56 53 30 31 00 00 01 00 00 02 00 00 00 00 00 00   VS01............
0010   01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
0020   00 00 00 00                                       ....

and Master response:

0000   56 53 30 31 08 00 02 00 00 00 00 00 00 02 00 00   VS01............
0010   01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00   ................
0020   00 00 00 00 c9 64 51 60 3b 00 00 00               ....ÉdQ`;...
                                     ....

It looks like a new UDP protocol --hundunzhidian 2019/4/30 10:11:58

hl2master.steampowered.com dead?

Is it safe to assume this method of retrieving the servers' list isn't working anymore since the release of http://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001 ?

I had a code which was working great and I only now realised it's been broken for a while.

--Pilger 18:32, 3 November 2012 (PDT)

C# sample

Anybody Please, make sample code on C# for receive server list from GoldSource Master Server.

Changes in Source Masterserver?

My Project just stopped working with the Masterserver Protocol. Also some larger Websites aren't able to display Server anymore. Does someone know whats going on? My wireshark analysis showed a Protocol starting with 'VS01', which is part of the Steam internal Protocol. Also the Server request from the Steam internal Server Browser is sent with the Main udp socket with which the authentication of the whole Steam client is done. Is it possible that you have now to authorize before requesting any Socket data? Btw, i already tested to resend new actual request packet which i captured but i didnt get an answer.

new API

Since the weekly Steam server maintenance on 2016-11-08/09, the master server is no longer responding to UDP queries. I found an undocumented Steam Web API method to get the server list instead.

The URL is https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=" + SteamWebApiKey + "&format=xml&filter=" + filters + "&limit=" + MaxAddresses

You can get a Steam Web API key for free at http://steamcommunity.com/dev/apikey

The format can be either json, xml or vdf

The filters are in the same format as before, like "appid\324810"

C# example

go example

A request like https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=YOUR_API_KEY&filter=appid\324810&limit=2 gives you a result like this:

	{
	"response": {
		"servers": [
			{
				"addr": "203.33.121.197:29215",
				"gameport": 7777,
				"steamid": "90103804961783814",
				"name": "Nerdtopia Tubgirl",
				"appid": 324810,
				"gamedir": "Toxikk",
				"version": "1.0.0.0",
				"product": "Toxikk",
				"region": 255,
				"players": 0,
				"max_players": 16,
				"bots": 0,
				"map": "BL-Foundation",
				"secure": true,
				"dedicated": true,
				"os": "w",
				"gametype": "CRZBloodLust"
			},
			{
				"addr": "97.82.69.125:27020",
				"gameport": 7782,
				"steamid": "90105073963186177",
				"name": "ZanWorld - Toxikk Server",
				"appid": 324810,
				"gamedir": "Toxikk",
				"version": "1.0.0.0",
				"product": "Toxikk",
				"region": 255,
				"players": 0,
				"max_players": 8,
				"bots": 0,
				"map": "BL-Foundation",
				"secure": true,
				"dedicated": true,
				"os": "w",
				"gametype": "CRZBloodLust"
			}
		]
		
	}
 	}


--Hbeham (talk) 11:35, 10 November 2016 (UTC)