Exemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         UpdateTitle();
         Output.WriteLine($"Emulador Enterprise Edition {vercion}");
         SessionManager.Initialize(server);
         HandlerManager.Initialize();
         SalasManager.Initialize();
         Output.WriteLine("Visualizar la conexión de usuarios: " + (ver_conexion_usuarios == true ? "true" : "false"));
         Output.WriteLine("Servidor iniciado correctamente!");
         Output.WriteLine("_________________________________________________");
         ServerThreads.Initialize();
         Console.Beep();
         if (control_panel == true)
         {
             panel_control form = new panel_control();
             form.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         Output.WriteLine(ex.ToString()); Program.EditorialResponse(ex);
         Console.ReadKey();
     }
 }
Exemplo n.º 2
0
 public void StopAll()
 {
     Parallel.ForEach(Config.Servers, async server => {
         await server.Stop();
     });
     Parallel.ForEach(ServerThreads, thread => {
         thread.Value.Abort();
         ServerThreads.Remove(thread.Key);
     });
 }
Exemplo n.º 3
0
        public async Task <Server> DeleteServer(string name)
        {
            ServerManager server = (from s in Config.Servers where s.Name == name select s).First();
            await server.Stop();

            Config.Servers.Remove(server);
            ServerThreads[server.Name].Abort();
            ServerThreads.Remove(server.Name);
            return(server);
        }
Exemplo n.º 4
0
 public void StartAll()
 {
     Console.WriteLine("Starting servers!");
     foreach (ServerManager server in Config.Servers)
     {
         Thread serverThread = new Thread(async() => {
             await server.StartAsync(Config.Path);
         });
         serverThread.Start();
         ServerThreads.Add(server.Name, serverThread);
     }
     OnServersStarted(new EventArgs());
 }
Exemplo n.º 5
0
        private void StartServer()
        {
            _listener = new TcpListener(IPAddress.Any, Config.LocalListenPort);
            _listener.Start();

            //spawn appropriate number of server threads
            for (int i = 0; i < Config.ServerThreadPoolCount; i++)
            {
                Server server = new Server(Config, _listener, _logger);
                ServerThreads.Add(server);

                //We listen to server events so that received file changes will not trigger
                //a send event from the Client
                server.ReceiveBegin += ServerReceiveStart;
                server.ReceiveEnd   += ServerReceiveComplete;
                server.Start();
            }
        }