Skip to content



Folders and files

Last commit message
Last commit date

Latest commit



32 Commits

Repository files navigation

Zanstat - .NET code for querying Zandronum servers

This repository provides a Nuget package and a command line console application for querying Zandronum using the Launcher Protocol and also using the RCon protocol.

Example Console Usage

Using this library it is very possible to build a discord bot (currently a work in progress):

Example Discord Bot

Console Application


zanstat <-server hostname:port> <-rcon RConServerPassword> [command]

where [command] is one of:

   -getname       Print server name
   -getmapname    Print current map name
   -getmaxplayers Print max players  
   -getpwads      Print pwads in use  
   -getiwad       Print iwad in use  
   -getskill      Print skill setting  
   -getlimits     Print various server limits  
   -getplayers    Print players currently on the server  
   -getteams      Print teams  


  • If -server is not supplied then it will default to localhost and port 10666
  • If -rcon is supplied then no command is needed. It will go into interactive mode where you can pass through any command you wish.
  • -getteams doesn't currently work! My server returns no data for this command.
  • For commands, you may only query the server every sv_queryignoretime seconds. If you query too frequently, the server will return an error code and the library will throw an exception.

Nuget Package

To use, instantiate the Zandronum class and pass through the server URL and port:

var zandronum = new Rocklan.Zanstat.Zandronum("", 10666);

Once instantiated you can then query the server for information like Server Name, Current Map, current Players, etc:

var mapName = _zandronum.MapName.Get();
var players = zandronum.Players.Get();

Console.WriteLine($"Players current on map: {mapName}");

foreach (var player in players)
    Console.WriteLine($"  {player}");

You can also connect to the server using RCon and it will raise events whenever the server raises events:

class MyCode
   function ConnectToZandronumServer()
       var zandronum = new Rocklan.Zanstat.Zandronum("", 10666);
       zandronum.Rcon.ServerMessage += Rcon_ServerMessage;

       Console.WriteLine("Listening to server messages, press enter to quit...");

   private void Rcon_ServerMessage(object sender, EventArgs e)
       string message = (e as ZandronumMessageEventArgs).Message;
       // Messages from the server have a newline appended, and they also 
       // have color coding embedded. You might want to filter out \\c- from the message

If you'd like to send message to the server you can do so using the SendCommand() function:

// return the list of maps
// change to map03:
_zandronum.Rcon.SendCommand("MAP MAP03");

Dev Notes

Many, many thanks go to legend Sam Izzo for doing 99% of the work - porting (and improving) the Java Huffman encoder, the UDP launcher code, and helping me get the RCon stuff working.

Beware, this library is using UDP, not TCP! UDP is a strange, weird world, brace yourself.


No description, website, or topics provided.






No releases published


No packages published


  • C# 100.0%