Beispiel #1
0
 private void StopServer()
 {
     if (_server != null)
     {
         _server.Stop();
         _server       = null;
         _adminService = null;
     }
 }
Beispiel #2
0
        private void StartServer()
        {
            var host = Settings.Default.connectionHost;

            _server       = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(host, 442));
            _adminService = new DataNormalizatorService();
            _adminService.OnClientCollectActivated   += ClientActivated;
            _adminService.OnClientCollectDeactivated += ClientDeactivated;
            _adminService.OnClientCrashed            += RemoveUserFromCollectQueue;
            _adminService.OnCollectRequest           += CollectRequest;
            _adminService.OnCollectFinished          += CollectFinished;
            _adminService.OnAllCollectStopped        += RemoveUserFromCollectQueue;
            _adminService.OnClientAddedNewSymbol     += RefreshSymbols;
            _server.AddService <IDataNormalizatorService, DataNormalizatorService>(_adminService);
            try
            {
                _server.Start();
            }
            catch (Exception e)
            {
                _server.Stop();
                Console.Write(e.Message);
            }
        }