NAME

qstat - Get statistics from Quake servers

SYNOPSIS

qstat [options ...] [-f file] [-qw host[:port]] [-qws host[:port]] [-h2s host[:port]]
[-raw delimiter] host[:port] ...

Version 2.0b

DESCRIPTION

QStat is a command-line program that displays information about Internet Quake servers. The servers are either down, non-responsive, or running a game. For servers running a game, the server name, map name, current number of players, and response time are displayed. Server rules and player information may also be displayed.

Several different Quake server types and derived games are supported. These can be divided into two categories: POQS (Plain Old Quake Server) and QuakeWorld. Quake shareware, Quake commercial (from CD), winquake, winded, unixded, and Hexen II are all POQS. The various versions of QuakeWorld and Quake II use a QuakeWorld type server. The distinction is based on network protocol used to query the servers, and affects the kind of information available for display.

The different server types can be queried simultaneously. If qstat detects that this is being done, the output is keyed by the type of server being displayed. See DISPLAY OPTIONS.

The Quake server may be specified as an IP address or a hostname. Servers can be listed on the command-line or, with the use of the -f option, a text file.

One line will be displayed for each server queried. The first component of the line will be the server's address as given on the command-line or the file. This can be used as a key to match input addresses to server status. Server rules and player information are displayed under the server info, indented by one tab stop.

GAME OPTIONS

These options select how a server should be queried. The address of POQS can be specified at the end of the command-line or in a file (see option -f.) QuakeWorld server addresses can be fetched from a QuakeWorld master using -qw or specified individually with -qws. The address of Quake II servers can be specified using the -qws option (must include port number) or in a file.

Alternatively, addresses can be listed in a file specified with -f. Each address in the file may be typed by the kind of server it is.

-qw host[:port]
Query a QuakeWorld master (host) for its server list and then query all the servers for status. The port defaults to 27000 if not specified.
-qws host[:port]
Query a single QuakeWorld server for status. The port defaults to 27500 if not specified. This option can be used to query a Quake II server by specifying the port number. Most Quake II servers use port 27910.
-h2s host[:port]
Query a single Hexen II server for status. The port defaults to 26900 if not specified.
-hexen2
Query using the Hexen II protocol. This mode only applies to POQS (non-QuakeWorld servers). More specifically, those addresses listed at the end of the command-line or that do not have a server type in an address file (see -f.)
-f file
Read host addresses from the given file. If file is -, then read from stdin. Multiple -f options may be used. The file should contain host names or IP addresses separated by white-space (tabs, new-lines, spaces, etc). If an address is preceded by a server type identifier, then qstat queries the address according to the server type. The server types are:
  QS      normal Quake server (POQS)
  H2S     Hexen II server (POQS)
  QW      QW server
  QWM     QW master server
  Q2      Quake II server (will assume a default port of 27910)

INFO OPTIONS

-R
Fetch and display server rules.
-P
Fetch and display player information.

DISPLAY OPTIONS

The qstat output should be self explanatory. However, the type of information returned is different between POQS and QuakeWorld. If qstat queries multiple server types, then each server status line is prefixed with a key:

  QS      normal Quake server (POQS)
  H2S     Hexen II server (POQS)
  QW      QW server
  QWM     QW master server
  Q2      Q2 server

-u
Only display hosts that are running a Quake server.
-nf
Do not display full servers.
-ne
Do not display empty servers.
-cn
Display color names instead of numbers. This is the default.
-ncn
Display color numbers instead of color names. This is the default for -raw mode.
-tc
Display time in clock format (DhDDmDDs). This is default.
-tsw
Display time in stop-watch format (DD:DD:DD).
-ts
Display time in seconds. This is the default for -raw mode.
-pa
Display player addresses. This is the default for -raw mode. Not available for QuakeWorld.
-hpn
Display player names in hex.
-old
Use pre-qstat 1.5 display style.
-raw delimiter
Display data in "raw" mode. The argument to -raw is used to separate columns of information. All information returned by the Quake server is displayed.
POQS output -- General server information is displayed in this order: command-line arg (IP address or host name), server name, server address (as returned by Quake server), protocol version, map name, maximum players, current players, average response time, number of retries. Server rules are displayed on one line as rule-name=value. If significant packet loss occurs, rules may be missing. Missing rules are indicated by a "?" as the last rule. Player information is displayed one per line: player number, player name, player address, frags, connect time, shirt color, pants color. A blank line separates each set of server information.
QuakeWorld server output -- General server information is displayed in this order: command-line arg (IP address or host name), server name, map name, maximum players, current players, average response time, number of retries. Server rules are displayed on one line as rule-name=value. Player information is displayed one per line: player number, player name, frags, connect time, shirt color, pants color, ping time (milliseconds), skin name. A blank line separates each set of server information.
QuakeWorld master output -- Master server information is displayed in this order: command-line arg (IP address or host name), number of servers. No other information is diplayed about a QW master.
Quake II server output -- General server information and server rules are the same as a QuakeWorld server. The rule names are somewhat different for Quake II. The player information currently returned is very limited: player name, frags, ping time (milliseconds). A blank line separates each set of server information.
-raw-arg
When used with -raw, always display the server address as it appeared in a file or on the command-line. Note that when -H is used with -raw, the first field of the raw output could be a hostname if the server IP address was resolved. This can make matching up input servers addresses with raw output lines fairly difficult. When -raw-arg is used, an additional field, the unresolved server address, is added at the beginning of all raw output lines.
-progress
Print a progress meter. Displays total servers processed, including timeouts and down servers. The meter is just a line of text that writes over itself with <cr>. Handy for interactive use when you are redirecting output to a file (the meter is printed on stderr).

SEARCH OPTIONS

-H
Resolve IP addresses to host names. Use with caution as many quake servers do not have registered host names. QStat may take up to a minute to timeout on each unregistered IP address. The duration of the timeout is controlled by your platform. Names are resolved before attempting to contact any hosts.
-interval seconds
Interval in seconds between retries. Specify as a floating point number. Default interval is 0.5 seconds.
-retry number
Number of retries. Qstat will send this many packets to a host before considering it non-responsive. Default is 3 retries.
-maxsimultaneous number
Number of simultaneous servers to query. Unix systems have an operating system imposed limit on the number of open sockets per process. This limit varies between 32 and 100 depending on the platform. On Windows 95 and Windows NT, the "select" winsock function limits the number of simultaneous queries to 64. These limits can be increased by minor changes to the code, but the change is different for each platform. Default is 20 simultaneous queries.
-timeout seconds
Total run time in seconds before giving up. Default is no timeout.

NOTES

The response time is a measure of the expected playability of the server. The first number is the server's average time in milli-seconds to respond to a request packet from qstat. The second number is the total number of retries required to fetch the displayed information. More retries will cause the average response time to be higher. The response time will be more accurate if more requests are made to the server. For POQS, a request is made for each server rule and line of player information. So setting the -P and -R options will result in a more accurate response time. Quake and Hexen II are POQS. For QuakeWorld and Quake II, qstat makes just one request to retrieve all the server status information, including server rules and player status. The -P and -R options do not increase the number of requests to the server.

Quake supports a number of control codes for special effects in player names. Qstat normalizes the codes into the ASCII character set before display. The graphic codes are not translated except the orange brackets (hex 90, 10, 91, and 11) which are converted to '[' and ']'. Use the hex-player-names option -hpn to see the complete player name.

Quake servers do not return version information. But some small amount of info can be gathered from the server rules. The noexit rule did not appear until version 1.01. The Quake II server rules includes a version key that appears to contain the id build number.

EXAMPLES

The following is an example address file which queries a QuakeWorld master, several Hexen II servers, some POQS, and a few Quake II servers.

QWM 192.246.40.12:27004
H2S 207.120.210.4
H2S 204.145.225.124
H2S 207.224.190.21
H2S 165.166.140.154
H2S 203.25.60.3
QS 207.25.198.110
QS 206.154.207.104
QS 205.246.42.31
QS 128.164.136.171
Q2 sm.iquest.net
Q2 209.39.134.5
Q2 209.39.134.3

If the above text were in a file called QSERVER.TXT, then the servers could be queried by running:
qstat -f QSERVER.TXT

IMPLEMENTATION NOTES

Qstat sends packets to each host and waits for return packets. After some interval, another packet is sent to each host which has not yet responded. This is done several times before the host is considered non-responsive. Qstat can wait for responses from up to 20 hosts at a time. For host lists longer than that, qstat checks more hosts as results are determined.

The following applies only applies to POQS. If qstat exceeds the maximum number of retries when fetching server information, it will give up and try to move on to the next information. This means that some rules or player info may occasionally not appear. Player info may also be missing if a player drops out between getting the general server info and requesting the player info. If qstat times out on one rule request, no further rules can be fetched. This is a side-effect of the Quake protocol design.

The number of available file descriptors limits the number of simultaneous servers that can be checked. QStat reuses file descriptors so it can never run out. The macro MAXFD in qstat.c determines how many file descriptors will be simultaneously opened. Raise or lower this value as needed. The default is 20 file descriptors.

Operating systems which translate ICMP Bad Port (ICMP_PORT_UNREACHABLE) into a ECONNREFUSED will display some hosts as DOWN. These hosts are up and connected to the network, but there is no program on the port. Solaris 2.5 and Irix 5.3 correctly support ICMP_PORT_UNREACHABLE, but Solaris 2.4 does not. See page 442 of "Unix Network Programming" by Richard Stevens for a description of this ICMP behavior.

Operating systems without correct ICMP behavior will just report hosts without Quake servers as non-responsive. Windows NT and Windows 95 don't seem to support this ICMP.

For hosts with multiple IP addresses, qstat will only send packets to the first address returned from the name service.

BUGS

QStat will report bogus reponse times if a server is listed multiple times in a file or on the command line. Generally, the later requests to the same server will take much longer. Be sure to cull duplicate addresses from your server list. On Unix, this can be done with sort | uniq.

PORTABILITY

QStat has been compiled and tested on Solaris 2.4/2.5/2.6, Irix 5.3/6.2/6.3, Windows NT 3.51 & 4.0, Windows 95, FreeBSD 2.2, BSDi, HP-UX 10.20, and various flavors of Linux.

WINDOWS

The Windows version of qstat (win32/qstat.exe) runs on Windows 95 and Windows NT as a console application. On Windows 95 and NT 4.0, short-cuts can be used to set the arguments to qstat. On Windows NT 3.51, use a batch file.

OS/2

An OS/2 binary is no longer included. Try contacting Per Hammer for an OS/2 Warp binary. per@mindbend.demon.co.uk.

VERSION

This is qstat version 2.0b. It works with every known version of Quake and all derivatives except versions of QuakeWorld before 1.5. No one is running pre-1.5 QuakeWorld, so this can hardly be a problem. The qstat webpage is updated for each new version and contains links to Quake server listings and pages about the Quake network protocol. The page can be found at
http://www.activesw.com/people/steve/qstat.html

Quake and Quake II created by id Software. Hexen II created by Raven Software.

AUTHOR

Steve Jankowski
steve@activesw.com

COPYRIGHT

Copyright © 1996,1997 by Steve Jankowski

Permission granted to use this software for any purpose you desire provided that existing copywrite notices are retained verbatim in all copies and derived works.