Talk:Master Server Query Protocol

From Valve Developer Community
Revision as of 15:41, 4 January 2009 by BarkerJr (talk | contribs) (No Response from
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 "". 

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


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 "" 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) );


		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: "" 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 "" 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


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)

No Response from

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