Example #1
0
 private static void Main(string[] args)
 {
     LogListener logListener = new LogListener(LogServerPort, ClientPort);
     SelfHost host = new SelfHost(ServiceServerPort, DispatcherServiceServerPort);
     host.Start();
     logListener.BeginListen();
     bool listen = true;
     while (listen)
     {
         Console.Clear();
         Console.WriteLine("Halo Online Server");
         Console.WriteLine("Listening on port " + LogServerPort);
         Console.WriteLine("Press escape to exit");
         Console.WriteLine("");
         Console.WriteLine("Connections:");
         foreach (var connection in logListener.GetConnectionList())
         {
             string connectionState = connection.Connected ? "connected" : "disconnected";
             Console.WriteLine("#{0} {1} {2} {3} {4}",
                 connection.Id,
                 connection.ClientId,
                 connection.ClientName,
                 connection.ClientComputerName,
                 connectionState);
         }
         if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
             listen = false;
         Thread.Sleep(100);
     }
     host.End();
     logListener.EndListen();
 }
Example #2
0
 private static void Main(string[] args)
 {
     var options = new ServerOptions
     {
         DispatcherPort = Settings.Default.DispatcherPort,
         EndpointHostname = Settings.Default.EndpointHostname,
         EndpointPort = Settings.Default.EndpointPort,
         LogPort = Settings.Default.LogPort,
         AppPort = Settings.Default.AppPort,
         ClientPort = Settings.Default.ClientPort
     };
     LogListener logListener = new LogListener(options.LogPort, options.ClientPort);
     ApiSelfHost apiHost = new ApiSelfHost(options);
     AppSelfHost appHost = new AppSelfHost(options);
     apiHost.Start();
     appHost.Start();
     logListener.BeginListen();
     FixDebugListeners();
     string infoText = GetInfoText(options);
     bool listen = true;
     while (listen)
     {
         Console.Clear();
         Console.Write(infoText);
         foreach (var connection in logListener.GetConnectionList())
         {
             string connectionState = connection.Connected ? "connected" : "disconnected";
             Console.WriteLine("#{0} {1} {2} {3} {4}",
                 connection.Id,
                 connection.ClientId,
                 connection.ClientName,
                 connection.ClientComputerName,
                 connectionState);
         }
         if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
             listen = false;
         Thread.Sleep(100);
     }
     appHost.End();
     apiHost.End();
     logListener.EndListen();
 }