[C++/C#] Remote Server Monitor
Introduction
This application is designed for convenient server administration and replication while retaining security. (I posted this in the Flyff section as well, but it wasn't getting many comments so I will post here since it can be used for any game).
Remote Server Monitor
The monitor is an application designed to run on an administrator's local computer. It then connects to a specified exclusive Controller Cloud. The administrator then will be able to start, stop, and control server-sided applications that the Controller Cloud has access to through a powerful GUI. The monitor is able to execute controls such as creating broadcasts, access control modifications, and anything else the server app developer wishes to implement via the XorRelayService library.
Relay Service
The Relay Service is a windows service that runs the server-sided applications as child processes in the background of the server machine itself. It relays commands and information to and from the Controller Clouds.
Controller Service
The Controller Service is essentially a proxy that administrators connect to with the Remote Server Monitor. The Controller Service will then connect to the server machines via the Relay Service. This allows for a more secure setup as the administrator will only be able to connect to one port on the internal network, while the Controller Cloud communicates with the server machines.
Screen Shots
http://img713.imageshack.us/img713/1...0531053001.png
http://image.xor.net/SS/2012-05-31_060136.png
http://image.xor.net/SS/2012-05-31_060104.png
http://image.xor.net/SS/2012-05-31_060040.png
http://image.xor.net/SS/2012-05-31_060028.png
API Header
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
// file: XorRelayServiceCli.h
//
// summary: Declares the XorNet Relay Service Client API.
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <Windows.h>
#include <vector>
#include <map>
// Callback typedef
typedef bool (*CmdHandler)();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> XorNet Relay Service Client API. </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
////////////////////////////////////////////////////////////////////////////////////////////////////
class XorRelayServiceCli
{
public:
XorRelayServiceCli();
virtual ~XorRelayServiceCli();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Adds a callback.
/// Commands called by Relay Service by default:
/// - "SaveAllExit"(calls this before "stop signal")
/// - "Census"(calls this to request the number of users online this server)
/// </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <param name="hCmd"> The command handler. </param>
/// <param name="szCommand"> The command string. </param>
/// <param name="szDescription"> The description string. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
static void AddCallback(CmdHandler hCmd, const char *szCommand, const char *szDescription);
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Sends a response to the Controller node. </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <param name="szResponse"> The response format. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
static void RespondToControl( const char *szResponse, ... );
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Used to retreive the input buffer, which can be used for reading dynamic commands.
/// </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <returns>
/// NULL if it fails, else the command 1024 char input buffer. The command code is not
/// included and the buffer will "never" be NULL.
/// </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
static const char* GetInputBuffer();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Initializes the Relay Service Client. </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <param name="szSrvName"> Name of the server app. </param>
/// <param name="szIniFile"> The path of the server app's INI file. </param>
/// <param name="nStartupNumber"> The startup number order(starts at 0). </param>
/// <param name="bCreateThread"> (optional) Create a new thread for processing. </param>
///
/// <returns> true if it succeeds, false if it fails. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
static bool Init(const char* szSrvName, const char* szIniFile, int nStartupNumber, bool bCreateThread=false);
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Connects to the Relay Service. Should be called after initial application loading
/// is done. After this is called, the next server will begin startup.
/// </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <returns> true if it succeeds, false if it fails. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
static bool Start();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gracefully disconnects the server app from the Relay Service after the Relay Service
/// signals stop. If this is called before the Relay Service signals, "stop", it will be
/// considered a crash.
/// </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <returns> true if it succeeds, false if it fails. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
static bool Stop();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Call this every 1-1000ms(100ms recommended) if the bCreateThread param was passed as
/// FALSE in the initialization call.
/// </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
///
/// <returns> TRUE if the "stop" signal has been received, the application should then exit. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
static bool Process();
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Retrieves strings from controller client. </summary>
////////////////////////////////////////////////////////////////////////////////////////////////////
static const char* GetIniFile();
static const char* GetServerName();
};
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Response codes </summary>
///
/// <remarks> Lethal, 5/31/2012. </remarks>
/////////////////////////////////////////////////////////////////////////////////////////////////
#define XORRC_RESPONSECODE_SERVER_READY "SERVER READY IDSTR = {6EC9D721-D946-4906-AB79-5AF7B35241CB}\n" // Notifies Relay Service that server app is ready!
#define XORRC_RESPONSECODE_SET_CUSTOM_STATE "Set Custom State {79CC1671-A46D-478a-9497-4933581B5B03},%d,%s\n" // Sets custom state(1st param: state id, 2nd param: state display name)
#define XORRC_RESPONSECODE_SERVER_ERROR "Server Error {FE58BC7B-ECE9-4d9a-85D0-ED6433ACAF6D},%s\n" // Sets Custom Error(1st param: error string to display)
#define XORRC_RESPONSECODE_WORLD_CENSUS "World Census {8B1B5C78-AB81-4c0f-B0EF-A380269E44C5},%d\n" // Sets World Census(1st param: CCU) -- Recommended one per "cluster"
#define XORRC_RESPONSECODE_ZONE_CENSUS "Zone Census {79CC1671-A46D-478a-9497-4933581B5B03},%d\n" // Sets Zone Census(1st param: CCU) -- Recommended one per zone "channel"
#define XORRC_RESPONSECODE_ADD_COMMAND "Add Command {79CC1671-A46D-478a-9497-4933581B5B03},%s,%s\n" // Adds Dynamic Command(1st param: display name, 2nd param: callback cmd name)
#define XORRC_RESPONSECODE_ADD_INPUT_COMMAND "Add Input Command {79CC1671-A46D-478a-9497-4933581B5B03},%s,%s\n" // Adds Dynamic Command(1st param: display name, 2nd param: callback cmd name)
#define XORRC_RESPONSECODE_REMOVE_COMMAND "Remove Command {79CC1671-A46D-478a-9497-4933581B5B03},%s\n" // Removes Dynamic Command(1st param: display name)
#define XORRC_RESPONSECODE_ENABLE_COMMAND "Enable Command {79CC1671-A46D-478a-9497-4933581B5B03},%s\n" // Enables Dynamic Command(1st param: display name)
#define XORRC_RESPONSECODE_DISABLE_COMMAND "Disable Command {79CC1671-A46D-478a-9497-4933581B5B03},%s\n" // Disables Dynamic Command(1st param: display name)
#define XORRC_RESPONSECODE_WORLD_ID "World ID {8E3FD4DA-BF63-4C6C-AA7D-013218CED9CA},%d\n" // Sets World ID(1st param: world id)
#define XORRC_RESPONSECODE_WAIT_COUNT "WaitCount {7E52C067-80A5-42AA-AA4D-6D25469B3C00},W[%d],L[%d]\n" // For Queues(untested)
#define XORRC_RESPONSECODE_AUX_1 "Aux1 {E9E41FAF-A7D0-4762-8446-C8E85CDC5065}\n" // Sets Aux1 status
#define XORRC_RESPONSECODE_AUX_2 "Aux2 {E4D780A7-873B-4888-8133-023DBCD680B4}\n" // Sets Aux2 status
Re: [C++/C#] Remote Server Monitor
This looks so cool +1 to you
Re: [C++/C#] Remote Server Monitor
Wow. Nice job.
Your description is a bit overwhelming, though. I had to read it a few times over to be able to get a grasp of what this server management tool is able to do.
I would recommend you simplify or at least define a lot of the terminology you use, especially if you want peoples to be able to understand what the application does.
So, correct me if I am wrong, but the chain is something like this:
My personal computer --> remote server monitor --> controller service --> relay service --> the game server.
And I can use your provided API to allow the game server to interact with the relay service, which in turn allows me to interact in a pre-determined way(as determined by how I implemented the API in my game server) with the game server--through the remote server monitor.
How far off am I?
Also, all I see is some minor documentation on your API. What's the status of the application... development, released somewhere else, costs $$$, or...?
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
timebomb
Wow. Nice job.
Your description is a bit overwhelming, though. I had to read it a few times over to be able to get a grasp of what this server management tool is able to do.
I would recommend you simplify or at least define a lot of the terminology you use, especially if you want peoples to be able to understand what the application does.
So, correct me if I am wrong, but the chain is something like this:
My personal computer --> remote server monitor --> controller service --> relay service --> the game server.
And I can use your provided API to allow the game server to interact with the relay service, which in turn allows me to interact in a pre-determined way(as determined by how I implemented the API in my game server) with the game server--through the remote server monitor.
How far off am I?
Also, all I see is some minor documentation on your API. What's the status of the application... development, released somewhere else, costs $$$, or...?
My apologies for the description, I wrote this when I was tired and I see how it is a bit unclear. It's a bit complicated, but I believe this setup allows for most convenient and secure administration.
The remote server monitor runs on the administrator's personal machine, then connects to the controller service which runs on a cloud. The controller service then connects to the relay service which is hosted on the actual server machine. The relay service connects to the server apps locally to route messages.
If I wanted to send a stop command to shut down a server app, it would go through like this:
- You right click on the server and press stop, then confirm.
- Remote Server Monitor sends message to Controller Service.
- Controller Service routes message to appropriate Relay Service.
- Relay Service gives the server app a message to shutdown.
The system is currently only used on our games, I don't see much possible profit from selling it to private servers at this time. It's designed to work best on an internal network or private VPN, which most private servers lack. It's been in "beta" for a few months now, still working out some minor bugs as I find them though. The documentation on the API is mainly for our developers if they want to implement additional dynamic controls.
I forgot to mention, the Remote Server Monitor uses a C# DLL for the GUI that is compiled with a C++/CLI application. It was much easier to work with the GUI in C# rather than in C++. I also used a .NET extension library, which I can give you the name of if you're interested(it offers a lot of great controls).
Re: [C++/C#] Remote Server Monitor
How do you get that SEXY GUI Lethal? And beast job on the API and program! Would love to be able to shit like this, hope to someday :).
Quote:
I forgot to mention, the Remote Server Monitor uses a C# DLL for the GUI that is compiled with a C++/CLI application. It was much easier to work with the GUI in C# rather than in C++. I also used a .NET extension library, which I can give you the name of if you're interested(it offers a lot of great controls).
Unsure if this is what I am looking for, but what I mean is the design, Ive seen a few programs like it.
Also, question, in an attempt to make something of my own like this, could I just simple make a socket program, make it listen for packets, and when it receives specific packets it does as requested e.g. act on request and give a response on the outcome, also ignore packets from unwanted IP address's.
Since I am fairly new, would this be a good approach or is it entirely stupid? Would love to see your opinion :).
Re: [C++/C#] Remote Server Monitor
So smexy.
I already have a bot that does "this" but yours looks more complex !
Awesome, truly awesome !
Re: [C++/C#] Remote Server Monitor
grats on editing the RoM server monitor/controller to your liking, tho I feel like you just used it as a "base" and built up around it, tweaking it to your liking. Not a bad job tho, not sure if you actually rewrote large portions of it tho, but regardless it can be used for any game given you have the code to it so you can add in the controller message bologna. Tho i digress a bit, anyways, +1 if you release it here (sounds like you may) otherwise fine job
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
cmb
grats on editing the RoM server monitor/controller to your liking, tho I feel like you just used it as a "base" and built up around it, tweaking it to your liking. Not a bad job tho, not sure if you actually rewrote large portions of it tho, but regardless it can be used for any game given you have the code to it so you can add in the controller message bologna. Tho i digress a bit, anyways, +1 if you release it here (sounds like you may) otherwise fine job
Have you even used the RoM server monitor/controller? If so, you'd know it has a completely different routing structure and isn't even designed to work as a library or for non-RoM games. I've rewritten at least 70% of the application and use none of the old RoM libraries. At best, you could say I got some ideas from Runewaker. I don't know what gave you the idea that I had any plans of releasing it, but maybe it would be a good idea not to make stupid assumptions that belittle my work in the same sentence you ask to get your hands on it, eh?
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
xLethal
Have you even used the RoM server monitor/controller? If so, you'd know it has a completely different routing structure and isn't even designed to work as a library or for non-RoM games. I've rewritten at least 70% of the application and use none of the old RoM libraries. At best, you could say I got some ideas from Runewaker. I don't know what gave you the idea that I had any plans of releasing it, but maybe it would be a good idea not to make stupid assumptions that belittle my work in the same sentence you ask to get your hands on it, eh?
woah woah woah, relax buddy. I never meant to try and belittle your work, all I meant was it looks very similar to the RoM server monitor/controller scheme (which you used as the "base") and ofc it isn't designed to be used for non-RoM games. It's obvious you rewrote most of it, tho I see you left the C++/CLI file structure intact. Regardless I had no interested in using it at all, but im sure there are others here that may, which is why I said +1 to releasing it, which obviously you will not be doing. Never meant for you to feel offended buddy
Re: [C++/C#] Remote Server Monitor
This is outstanding, good work!
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
cmb
woah woah woah, relax buddy. I never meant to try and belittle your work, all I meant was it looks very similar to the RoM server monitor/controller scheme (which you used as the "base") and ofc it isn't designed to be used for non-RoM games. It's obvious you rewrote most of it, tho I see you left the C++/CLI file structure intact. Regardless I had no interested in using it at all, but im sure there are others here that may, which is why I said +1 to releasing it, which obviously you will not be doing. Never meant for you to feel offended buddy
Sorry about that, I guess I just took the "tone" of your message wrong. I admit I could have written the app entirely in C#, but I'm not that familiar with C# networking honestly. However, if I was to write the app now I would've made the application itself in C# and used some C/C++ DLLs for networking. I'm not that fond of C++/CLI honestly now that I've learned more about it.
As for releasing it, I don't think I ever will, but I already have given the compiled modules to a few non-XorNet developers that were interested. I'd be happy to give it to any developers or administrators that are serious about their jobs(even if they work on pservers), but I don't want it leaked to the main pserver community due to my opinion on pservers in general.
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
xLethal
Sorry about that, I guess I just took the "tone" of your message wrong. I admit I could have written the app entirely in C#, but I'm not that familiar with C# networking honestly. However, if I was to write the app now I would've made the application itself in C# and used some C/C++ DLLs for networking. I'm not that fond of C++/CLI honestly now that I've learned more about it.
As for releasing it, I don't think I ever will, but I already have given the compiled modules to a few non-XorNet developers that were interested. I'd be happy to give it to any developers or administrators that are serious about their jobs(even if they work on pservers), but I don't want it leaked to the main pserver community due to my opinion on pservers in general.
Indeed, I apologize for the tone of my first message. Truly the foundations of networking is the same with all languages, it just varies by implementation :) Yes, I personally despise C++/CLI its just disgusting and ugly, its microsoft's way of "modernizing" C++ into the world of C#, and honestly it falls flat on its face. Anyways, I agree about the whole not wanting software like this getting into the hands of everybody, especially since there are so many noobs and leechers who wouldn't even know how to begin to implement this for their own work (if you can even call it that). All in all, its nice to see this, because honestly I liked the RoM server monitor/controller system, I felt like it was one of the better implementations of such a scheme in MMOs these days (especially ones that originate overseas).
Re: [C++/C#] Remote Server Monitor
Quote:
Originally Posted by
xLethal
I forgot to mention, the Remote Server Monitor uses a C# DLL for the GUI that is compiled with a C++/CLI application. It was much easier to work with the GUI in C# rather than in C++. I also used a .NET extension library, which I can give you the name of if you're interested(it offers a lot of great controls).
I am quite interested in the .NET lib, if you're willing to either post or pm me the name I'd appreciate it.
Re: [C++/C#] Remote Server Monitor
Re: [C++/C#] Remote Server Monitor
Aw, dammit! I thought this was a release and I got excited and then I scroll down and don't see a download :(.