コード例 #1
0
 /// <summary>
 /// Stops the TCP Server
 /// </summary>
 protected void TCPServerStop()
 {
     if (_messageServer != null)
     {
         _messageServer.Stop();
     }
 }
コード例 #2
0
ファイル: SocketServerTest.cs プロジェクト: treverson/prime
        public void Go(ServerContext sCtx, ClientContext cCtx)
        {
            _sCtx = sCtx;
            _cCtx = cCtx;

            var mr     = false;
            var server = new MessageServer(sCtx);

            sCtx.M.RegisterAsync <HelloRequest>(this, x =>
            {
                sCtx.M.Send(new HelloResponse(x));
            });

            cCtx.Messenger.RegisterAsync <HelloResponse>(this, x =>
            {
                cCtx.Logger.Log(x.Response + " " + x.ClientId);
                mr = true;
            });

            server.Start();

            SendAsClient(server, cCtx.Messenger, new HelloRequest());

            do
            {
                Thread.Sleep(1);
            } while (!mr);

            server.Stop();
        }
コード例 #3
0
 /// <summary>
 /// Stops the message server.
 /// </summary>
 private void Stop()
 {
     lock (_objLock) {
         if (_messageServer != null)
         {
             _messageServer.Stop();
         }
         _messageServer = null;
         Log.Info("Stopped GodLesZ.Library.Amf Gateway");
     }
 }
コード例 #4
0
 /// <summary>
 /// Stops the message server.
 /// </summary>
 private void Stop()
 {
     lock (_objLock)
     {
         if (_messageServer != null)
         {
             _messageServer.Stop();
         }
         _messageServer = null;
         Log.Info("Stopped FluorineFx Gateway");
     }
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: wuyingyou/uniframework
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new ConsoleTraceListener());

            // 启动服务器
            using (MessageServer server = new MessageServer()) {
                server.Port = 8088;
                server.Start();

                Console.WriteLine("Press enter key to exit...");
                Console.ReadLine();
                server.Stop();
            }
        }
コード例 #6
0
        /// <summary>
        /// [implementation of IHostedService]
        /// Triggered when the host is performing a graceful shutdown.
        /// StopAsync contains the logic to end the background task.
        /// Implement IDisposable and finalizers (destructors) to dispose of any unmanaged resources.
        /// </summary>
        /// <param name="cancellationToken">Indicates that the shutdown process should no longer be graceful.</param>
        /// <returns>Task</returns>
        public Task StopAsync(CancellationToken cancellationToken)
        {
            if (_server != null && _server.IsStarted)
            {
                _server.Stop();
                _logger.LogInformation("TcpServer STOPPED");
                _fileLogger.WriteProgramLog($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} TcpServer STOPPED");
            }
            else
            {
                _logger.LogWarning("TcpServer already stopped");
                _fileLogger.WriteProgramLog($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} TcpServer already stopped");
            }

            return(Task.CompletedTask);
        }
コード例 #7
0
ファイル: AMFGateway.cs プロジェクト: saggelopoulos/AMFCore
 void CurrentDomain_DomainUnload(object sender, EventArgs e)
 {
     try
     {
         lock (_objLock)
         {
             if (messageServer != null)
             {
                 messageServer.Stop();
             }
             messageServer = null;
         }
     }
     catch (Exception)
     { }
 }
コード例 #8
0
        public static void Main()
        {
            try
            {
                MessageServer.LoginServerConnection = new InteroperabilityClient(new IPEndPoint(
                                                                                     Settings.GetIPAddress("IP", "Interconnection"),
                                                                                     Settings.GetInt("Port", "Interconnection")),
                                                                                 Settings.GetString("SecurityCode", "Interconnection"));

                MessageServer.LoginServerConnection.Loop();
            }
            catch (Exception e)
            {
                Log.Error("Server connection failed: \n{0}", e.ToString());

                MessageServer.Stop();
            }
        }
コード例 #9
0
 private void CurrentDomain_DomainUnload(object sender, EventArgs e)
 {
     try
     {
         lock (_objLock)
         {
             if (messageServer != null)
             {
                 messageServer.Stop();
             }
             messageServer = null;
         }
         LogManager.GetLogger(typeof(FluorineGateway)).Info("Stopped FluorineFx Gateway");
     }
     catch (Exception)
     {
     }
 }
コード例 #10
0
 protected override void StopServer()
 {
     MessageServer.Stop();
 }
コード例 #11
0
 public void Stop()
 {
     net_server.Stop();
     net_server.Join();
 }