GithubHelp home page GithubHelp logo

Feature Request about mbcon HOT 2 OPEN

Cartmansp69 avatar Cartmansp69 commented on July 25, 2024
Feature Request

from mbcon.

Comments (2)

SithisSir avatar SithisSir commented on July 25, 2024

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 :)

from mbcon.

SithisSir avatar SithisSir commented on July 25, 2024

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.

from mbcon.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.