Esempio n. 1
0
 public static void StopServer()
 {
     if (IsServerStarted)
     {
         server?.Stop();                 //Stop the server
         IsServerStarted = false;
     }
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        private void StopServer()
        {
            scsServer.ClientConnected    -= ServerClientConnected;
            scsServer.ClientDisconnected -= ServerClientDisconnected;

            scsServer.Stop();
            scsServer = null;

            Start.LargeGlyph = new BitmapImage(new Uri("Images/Start.png", UriKind.Relative));
        }
Esempio n. 3
0
 public bool Stop()
 {
     try
     {
         _scsServer.Stop();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 4
0
 public Boolean CloseServer()
 {
     try
     {
         server.Stop();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 5
0
 public void StopServer()
 {
     try
     {
         _server.Stop();
         log.Info("Stopping Server");
     }
     catch (Exception ex)
     {
         log.Error("Error when stopping Server", ex);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 停止服务
        /// </summary>
        public void Stop()
        {
            if (config.HttpEnabled)
            {
                httpServer.Stop();
            }

            server.Stop();
            server.Clients.ClearAll();
            container.Dispose();

            //停止所有线程
            smart.Shutdown();
        }
Esempio n. 7
0
        public void Dispose()
        {
            try
            {
                stop_1s_timer();

                _sclients.Clear();

                if (_server != null)
                {
                    _server.Stop();
                    _server = null;
                }
            }
            catch { }
        }
Esempio n. 8
0
        public void Start()
        {
            _config   = ServerConfig.LoadConfig();
            _receiver = new ServerReceiver(_server);
            _server   = ScsServerFactory.CreateServer(new ScsTcpEndPoint(_config.Ip, _config.Port));

            new ServerLogic(_receiver, _server);

            _server.ClientConnected += Client_Connected;

            _server.Start();


            Console.WriteLine("Enter something to close server");
            Console.ReadLine();
            _server.Stop();
        }
        public void Stop()
        {
            try
            {
                _logger.Info("Shutting down server...");
                foreach (var client in _clients)
                {
                    client.Value.Disconnect("Server is off");
                }

                _server.Stop();
                _clients.Clear();
            }
            finally
            {
                _logger.Info("Server is terminated!");
            }
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            IScsServer server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(LISTENING_PORT));

            server.WireProtocolFactory = new MyWireProtocolFactory();
            server.ClientConnected    += Server_ClientConnected;
            server.ClientDisconnected += Server_ClientDisconnected;

            server.Start(); //Start the server

            Console.WriteLine("Server is started successfully. Press enter to stop...");
            Console.ReadLine(); //Wait user to press enter

            // Disconnect all connected client
            foreach (IScsServerClient client in server.Clients.GetAllItems())
            {
                client.Disconnect();
            }
            server.Stop(); //Stop the server
        }
Esempio n. 11
0
 public override void StopServer()
 {
     _server.Stop();
     _server.ClientConnected    -= OnServerClientDisconnected;
     _server.ClientDisconnected -= OnServerClientConnected;
 }
Esempio n. 12
0
 public void CloseSockets()
 {
     _server.Stop();
 }
Esempio n. 13
0
 public void Stop()
 {
     _server.Stop();
 }
Esempio n. 14
0
 public void ShutdownServer()
 {
     Log.Info("Shutdown TcpServer...");
     Server.Stop();
 }
Esempio n. 15
0
 public void Stop()
 {
     ScsServer.Stop();
 }
Esempio n. 16
0
 public void ShutdownServer()
 {
     Logger.WriteLine(LogState.Info, "Shutdown LoginServer...");
     Server.Stop();
 }
 /// <summary>
 ///     Stops service application.
 /// </summary>
 public void Stop() => _scsServer.Stop();