Пример #1
0
        private static void HandleAdmin(Socket socket)
        {
            bool keepRunning = true;

            while (keepRunning)
            {
                try
                {
                    CommandPackage package = CommandProtocol.RecieveCommand(socket);
                    switch (package.Command)
                    {
                    case CommandConstants.Logs:
                        LogServer.GetInstance().AdminLog(socket, package);
                        break;

                    case CommandConstants.LogInfo:
                        LogServer.GetInstance().AdminInfo(socket, package);
                        break;

                    case CommandConstants.LogWarning:
                        LogServer.GetInstance().AdminWarning(socket, package);
                        break;

                    case CommandConstants.LogError:
                        LogServer.GetInstance().AdminError(socket, package);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    keepRunning = false;
                    socket.Shutdown(SocketShutdown.Both);
                    socket.Close();
                }
            }
        }
Пример #2
0
 static void Main(string[] args)
 {
     LogServer.GetInstance().Consumer();
 }