Difference between revisions of "Master Server Query Protocol"
Line 10: | Line 10: | ||
| [[Byte]] || Region Code || See below | | [[Byte]] || Region Code || See below | ||
|- | |- | ||
− | | [[ | + | | [[Byte]] x 4 || IP || See below |
|- | |- | ||
| [[String Zero]] || Filter || See below | | [[String Zero]] || Filter || See below |
Revision as of 21:47, 16 June 2006
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 |
Byte x 4 | IP | See below |
String Zero | Filter | See below |
Region Codes
The region of the world that you wish to find servers in.
Byte | Description |
---|---|
0x00 | US East coast |
0x01 | US West coast |
0x02 | South America |
0x03 | Europe |
0x04 | Asia |
0x05 | Australia |
0x06 | Middle East |
0x07 | Africa |
0xFF | Rest of the world |
IP
The first IP Steam sends is 4 0's
From then on, IP becomes the last IP received in the master servers reply. This allows steam to then grab another list of more servers.
Filter
Allows you to restrict the results to servers running a certain game, map, etc.
Send an empty string (0x00) to recieve a list of all types of servers.
Insert \
in between filter parameters
\type\d
- Servers running dedicated
\secure\1
- Servers using anti-cheat technology (VAC)
\gamedir\[mod]
- Servers running the specified modification (ex. cstrike)
\map\[map]
- Servers running the specified map (ex. cs_italy)
\linux\1
- Servers running on a Linux platform
\empty\1
- Servers that are not empty
\full\1
- Servers that are not full
\proxy\1
- Servers that are spectator proxies
Sample Query
31 0 0 0 0 0 0
To get all servers on the east coast
Master Servers
Current master servers are
- 69.28.151.162:27010
- 207.173.177.11:27010
- 68.142.72.250:27010
- 68.142.72.250:27011
- 69.28.151.162:27011
- 207.173.177.12:27012
- 207.173.177.11:27012
- 69.28.151.162:27010
If you can, get your application to check the file Steam\config\masterservers.vdf
to get the latest list of master servers.
Reply Format
The reply always starts with FF FF FF FF 66 0A
.
The format is then a series of these server address blocks:
Type | Data |
---|---|
Byte | First octet of IP address |
Byte | Second octet of IP address |
Byte | Third octet of IP address |
Byte | Fourth octet of IP address |
Unsigned Short | Port number - usually 27015 (69 87 ) - this is network ordered, which is unlike every other Steam protocol.
|
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.
Game server to master server
Join
Shortly 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" (71
).
The master servers each respond by sending FF FF FF FF 73 0A
followed by a (relatively) unique 4-byte "challenge" number.
Challenge response
After receiving the challenge packet, the game server then sends its challenge information in the following format:
Goldsource
002a 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, 1339895702 (0x4FDD2F96
) in this example, is the reverse of the challenge number originally sent by the server (96 2F DD 4F
).
Source
002a 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, 133961823 (0x07FC185F
) in this example, is the reverse of the challenge number originally sent by the server (5F 18 FC 07
).
Differences
The field order is a bit different with Source than with Goldsource.
Goldsource | protocol | challenge | players | max | bots | gamedir | map | type | password | os | secure | lan | version | region | product |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Source | protocol | challenge | players | max | bots | gamedir | map | password | os | lan | region | type | secure | version | product |
Heartbeat
A "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
Goldsource
The game server sends the master server 62 0A
to signal that the game server has shut down.
Source
The game server sends the master server 62 0A 00
to signal that the game server has shut down.