
- You can finally do RCON in .NET too!
What's this?
Huffman .NET is a sort of wrapper for the native C/C++ Huffman library for Skulltag/Zandronum.
Huffman is the name of the encoding algorithm that Skulltag and Zandronum servers use when communicating with their RCON clients, and it must be used in order to properly communicate with a server.
What's RCON?
I find it strange if you've read this far but don't know what RCON is (and if that's the case maybe you're just an interested reader?
RCON (when talking about gaming) stands for Remote CONsole, which refers to an interface used to remotely administrate game servers without having to have physical access to the machine that the server runs on. Different types of game servers usually use their own implementation of an RCON protocol (if any at all).
How does Huffman .NET work?
The Huffman .NET library contains a .NET Framework-friendly class with methods for encoding/decoding data using the Zandronum compatible Huffman algorithm. The library does all the tricky, annoying calls and platform invokes required to use the native methods in .NET. It also handles the outputs from those methods and puts it together into an array of bytes with the correct length.
In which programming languages can I use this?
Huffman .NET should work in most .NET Framework-based languages, but it is no guarantee. The library was written in Visual Basic .NET, but since it's compiled into a DLL it will work in for example C# too (I have just tested it quickly in C#, but due to how similar it and VB.NET are there should really not be any problems).
How do I implement Huffman .NET into my project?
The library consists of two files - HuffmanNET.dll and HuffmanNative.dll.
- HuffmanNET.dll is the main DLL-file containing the .NET Framework-friendly class and its methods.
- HuffmanNative.dll is the compiled C++ DLL of the native Huffman library. It contains the algorithm itself, therefore you'll need both of the files in order for this to work.
Note: The following applies to VB.NET and C# when using Visual Studio. If you use another programming language or another IDE you might have to look into adding DLL references on your own.
- To start with add a reference in your project to the HuffmanNET.dll file.
- Add HuffmanNative.dll as a file in your project (not as a reference) and make sure it is copied to the output directory.
- Alternatively copy it to the output directory yourself. - Import the HuffmanNET namespace.
- You can now start using the Huffman class!
Overview of methods and properties
[spoiler]
Encode(byte[])- Encodes the input byte array using the Huffman algorithm.
Decode(byte[])- Decodes the input byte array using the Huffman algorithm.
(int32) EncodeDecodeBuffer- The encoding/decoding buffer limit (in bytes). The algorithm cannot encode or decode data that is larger than this.
- Default is 8192.
Initialize()- Initializes the Huffman library and subscribes to the applciation's ApplicationExit event in order to automtically run cleanup code when the application terminates.
- (Must be called before using the other methods in library!)[/spoiler]
Download
Attention: Currently this library is only supported in Windows Forms applications!
If you would like to use it in a Console Application, WPF or anything else please contact me and I'll create an independant library for you.
Download Huffman .NET compiled for .NET Framework 4.0 (or higher)
Download Huffman .NET compiled for .NET Framework 3.5
Support
If you have any questions, suggestions or need any help you can:
- Write a post in this thread.
- Write a private message to me on this forum.
- Write an e-mail to me on: support [at] mydoomsite.com