Master Server Query Protocol: Difference between revisions
(→Filter) |
|||
Line 59: | Line 59: | ||
;<code>\napp\[appid]</code> | ;<code>\napp\[appid]</code> | ||
:Servers that are NOT running game [[Steam Application IDs|[appid]]] (This was introduced to block Left 4 Dead games from the Steam Server Browser) | :Servers that are NOT running game [[Steam Application IDs|[appid]]] (This was introduced to block Left 4 Dead games from the Steam Server Browser) | ||
;<code>\ | ;<code>\24\1</code> | ||
:Servers that are empty | :Servers that are empty | ||
;<code>\white\1</code> | ;<code>\white\1</code> |
Revision as of 08:39, 9 November 2009
Client to master server
Send the following UDP query to a master server to get a list of Source host servers.
Format
Type | Field | Value |
---|---|---|
Byte | Message Type | 0x31 - the character "1" |
Byte | Region Code | See below |
String Zero | IP:Port | See below |
String Zero | Filter | See below |
Region codes
The region of the world that you wish to find servers in.
Byte | Description | 0x03 | Europe
IP:PortThe first IP:Port you should send is "41.99.155.45" From then on, IP:Port becomes the last IP:Port received in the master servers reply. This allows steam to then grab another list of more servers. Terminate this with 0x00 Note that whenever you open a new socket (and thus get a new random client port), the Master Server will always send you the first batch of IPs even if you pass a valid game server IP. Do not close your socket between packets. FilterAllows you to restrict the results to servers running a certain game, map, etc. Send an empty string (0x00) to receive a list of all types of servers. Insert
Sample queryTo get all servers everywhere: 0000 31 FF 30 2E 30 2E 30 2E 1.0.0.0. 0008 30 3A 30 00 00 0:0.. This is the default Steam Server Browser query to the Source Master Server. It uses the napp filter to filter out Left 4 Dead games (which are meant to be joined using the matchmaking feature). 31 ff 30 2e 30 2e 30 2e 30 3a 30 00 5c 6e 61 70 1.0.0.0.0:0.\nap 70 5c 35 30 30 00 p\500. Master serversCurrent master servers are:
If you can, get your application to check the file Reply formatThe reply always starts with The format is then a series of these server address blocks:
Some of the servers may be unreachable, so query each server directly to find out. Note also that this list is not exhaustive, so if you're looking for a particular type of server make sure that you specify a filter with the query, rather than filtering client side. End of IP address listThe full requested IP list may not fit in 1 x packet. Subsequent packets must be requested by using the last received IP address and Port as the 'seed' in the next request. The end of the IP list is indicated by a received IP address of 0.0.0.0 Port:0. Game server to master serverJoinShortly after a game server has been initialized, it picks two master servers to "join." In order for clients to see a particular game server when they click on the "Internet" tab, the game server must be present in the Steam master servers' records. The game server sends each master server "q" ( The master servers each respond by sending Challenge responseAfter receiving the challenge packet, the game server then sends its challenge information in the following format: Goldsource002a 30 0a 5c 70 72 6f 0.\pro 0030 74 6f 63 6f 6c 5c 34 37 5c 63 68 61 6c 6c 65 6e tocol\47\challen 0040 67 65 5c 31 33 33 39 38 39 35 37 30 32 5c 70 6c ge\1339895702\pl 0050 61 79 65 72 73 5c 30 5c 6d 61 78 5c 32 5c 62 6f ayers\0\max\2\bo 0060 74 73 5c 30 5c 67 61 6d 65 64 69 72 5c 63 73 74 ts\0\gamedir\cst 0070 72 69 6b 65 5c 6d 61 70 5c 64 65 5f 64 75 73 74 rike\map\de_dust 0080 5c 74 79 70 65 5c 64 5c 70 61 73 73 77 6f 72 64 \type\d\password 0090 5c 30 5c 6f 73 5c 6c 5c 73 65 63 75 72 65 5c 30 \0\os\l\secure\0 00a0 5c 6c 61 6e 5c 30 5c 76 65 72 73 69 6f 6e 5c 31 \lan\0\version\1 00b0 2e 31 2e 32 2e 35 2f 53 74 64 69 6f 5c 72 65 67 .1.2.5/Stdio\reg 00c0 69 6f 6e 5c 32 35 35 5c 70 72 6f 64 75 63 74 5c ion\255\product\ 00d0 63 73 74 72 69 6b 65 0a cstrike. The challenge number is simply the challenge sent by the master server converted to an int. Source002a 30 0a 5c 70 72 6f 0.\pro 0030 74 6f 63 6f 6c 5c 37 5c 63 68 61 6c 6c 65 6e 67 tocol\7\challeng 0040 65 5c 31 33 33 39 36 31 38 32 33 5c 70 6c 61 79 e\133961823\play 0050 65 72 73 5c 30 5c 6d 61 78 5c 32 5c 62 6f 74 73 ers\0\max\2\bots 0060 5c 30 5c 67 61 6d 65 64 69 72 5c 63 73 74 72 69 \0\gamedir\cstri 0070 6b 65 5c 6d 61 70 5c 64 65 5f 64 75 73 74 5c 70 ke\map\de_dust\p 0080 61 73 73 77 6f 72 64 5c 30 5c 6f 73 5c 6c 5c 6c assword\0\os\l\l 0090 61 6e 5c 30 5c 72 65 67 69 6f 6e 5c 32 35 35 5c an\0\region\255\ 00a0 74 79 70 65 5c 64 5c 73 65 63 75 72 65 5c 30 5c type\d\secure\0\ 00b0 76 65 72 73 69 6f 6e 5c 31 2e 30 2e 30 2e 32 38 version\1.0.0.28 00c0 5c 70 72 6f 64 75 63 74 5c 63 73 74 72 69 6b 65 \product\cstrike 00d0 0a . The challenge number is simply the challenge sent by the master server converted to an int. Orangebox0000 30 0a 5c 70 72 6f 74 6f 63 6f 6c 5c 37 5c 63 68 0.\protocol\7\ch 0010 61 6c 6c 65 6e 67 65 5c 31 39 35 39 36 38 37 33 allenge\19596873 0020 39 39 5c 70 6c 61 79 65 72 73 5c 31 5c 6d 61 78 99\players\1\max 0030 5c 34 5c 62 6f 74 73 5c 30 5c 67 61 6d 65 64 69 \4\bots\0\gamedi 0040 72 5c 74 66 5c 6d 61 70 5c 61 72 65 6e 61 5f 62 r\tf\map\arena_b 0050 61 64 6c 61 6e 64 73 5c 70 61 73 73 77 6f 72 64 adlands\password 0060 5c 30 5c 6f 73 5c 77 5c 6c 61 6e 5c 31 5c 72 65 \0\os\w\lan\1\re 0070 67 69 6f 6e 5c 2d 31 5c 67 61 6d 65 74 79 70 65 gion\-1\gametype 0080 5c 61 72 65 6e 61 5c 74 79 70 65 5c 6c 5c 73 65 \arena\type\l\se 0090 63 75 72 65 5c 30 5c 76 65 72 73 69 6f 6e 5c 31 cure\0\version\1 00a0 2e 30 2e 34 2e 33 5c 70 72 6f 64 75 63 74 5c 74 .0.4.3\product\t 00b0 66 0a f. The challenge number is simply the challenge sent by the master server converted to an int. DifferencesThe field order is a bit different with Source than with Goldsource.
HeartbeatA "heartbeat" occurs every five minutes in order to let the master servers know that a game server is still "alive". The game server simply goes through the process of "joining" the master server list again. Quit
See also |
---|