Пример #1
0
        static void Main()
        {
            Server server = new Server(null, 9000, false, RequestReceived, true);

            bool runForever = true;

            while (runForever)
            {
                string userInput = WatsonCommon.InputString("Command [? for help] >", null, false);
                switch (userInput.ToLower())
                {
                case "?":
                    Menu();
                    break;

                case "q":
                    runForever = false;
                    break;

                case "c":
                case "cls":
                    Console.Clear();
                    break;

                case "state":
                    Console.WriteLine("Listening: " + server.IsListening);
                    break;

                case "dispose":
                    server.Dispose();
                    break;
                }
            }
        }
Пример #2
0
        static void Main()
        {
            List <string> hostnames = new List <string>();

            hostnames.Add("127.0.0.1");

            Server server = new Server(hostnames, 9000, false, RequestReceived);

            // server.AccessControl.Mode = AccessControlMode.DefaultDeny;
            // server.AccessControl.Whitelist.Add("127.0.0.1", "255.255.255.255");
            // server.AccessControl.Whitelist.Add("127.0.0.1", "255.255.255.255");

            bool runForever = true;

            while (runForever)
            {
                string userInput = WatsonCommon.InputString("Command [? for help] >", null, false);
                switch (userInput.ToLower())
                {
                case "?":
                    Menu();
                    break;

                case "q":
                    runForever = false;
                    break;

                case "c":
                case "cls":
                    Console.Clear();
                    break;

                case "state":
                    Console.WriteLine("Listening: " + server.IsListening);
                    break;

                case "dispose":
                    server.Dispose();
                    break;
                }
            }
        }