maca134/MBCon

Feature Request

Opened this issue · 2 comments

Good day

Firstly I want to say Great Job on this tool I really like it easy to setup and get working.

I would like to request 3 possible features

A way to schedule dynamic messages that runs at specific times of the day, the reason i ask for this is that global chat is often missed.

On the webcon side a way to send server commands like #shutdown I know webcon is still a new feature but that would be great.

Also I'm having issues with mbcon closing when my server restarts and having to reopen it manually or using a script that monitors my Arma process, maby build in some kind of timer where mbcon waits a min before trying to reconnect with 5 tries if after 5 tries it cannot connect then close that gives the server 5 min to come back up and prevent mbcon from closing.

Thanks and Regards keep up the good work.

Hi. Sorry for late answer (and maybe its not in my business). Can answer only to last request, about reconnecting. You can tune time and nubmer of tries manually in some way. It tries to connect every 1 sec for 5 times. You can adjust it, if you can recompile MBCon in VS.

You need to edit MBCon -> Classes -> core.cs. Integer for number of tries is _maxtries = 5;, on line 38. Change it to 300, as example, if you want it to wait for 5 mins (it will try to connect for 5 mins).

Another way to change the time between reconnect tries. You need to adjust Thread.Sleep(1000) on the line 123 (same file). As example, you can set _maxtries = 10 and Thread.Sleep(30000) so it will try to connect 10 times with wait before reconnect of 30 sec, resulting 5 minutes.

Another, more complex (and maybe buggy) way is to replace throw new CoreException("Failed to connect to server."); on line 128 with something like Thread.Sleep(300000); goto mark; (mark: for goto before for cycle in public void Connect()), so it will sleep for 5 minutes and then try to reconnect again. But it may cause infinity loop if it is not connected to a server, so be careful.

All of these require at least Visual Studio to recompile project.
Hope that it will help you or any other looking for this. And hope Maca134 will insert smth to configure at least number of tries in config file :)

Another way, i set it to try 25 times to connect, then wait for minute and try to connect again (it will try to connect 3 times, each time 25 tries and 60 seconds between each 25 tries, then shutdown).
You can copy code below and paste it replacing yours in VS or i can send you compilated .exe
public void Connect() { for (var ia = 1; ia <= 3; ia++) { for (var tries = 1; tries <= _maxtries; tries++) { try { _beclient.Connect(); if (!_beclient.Connected) throw new CoreException(); break; } catch { AppConsole.Log(String.Format("Failed to connect to server. Attempt {0}/{1}", tries, _maxtries), ConsoleColor.Red); } Thread.Sleep(1000); } Thread.Sleep(60000); } if (!_beclient.Connected) { throw new CoreException("Failed to connect to server."); } _connected = true; }

Code isnt good looking in github, dunno why.