Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var server = new TCPServer(IPAddress.Any, 9999);
            server.StartServer();
            Console.WriteLine("Server is started");
            Console.WriteLine("Type 'stop' to stop server");
            Console.WriteLine("Type 'loadtoredis' to load all phone and email from database to redis");

            var msg = string.Empty;
            while (msg != "stop")
            {
                msg = Console.ReadLine();
                if (msg == "loadtoredis")
                {
                    Console.WriteLine("Please waiting...");
                    StaticData.LoadToRedis();
                    Console.WriteLine("Load successfully !");
                }
            }
            StaticData.ClearData();
            Console.WriteLine("Server is stopping...");
            Console.WriteLine("Server is stopped...");
            server.StopServer();

            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Set things in motion so your service can do its work.
 /// </summary>
 protected override void OnStart(string[] args)
 {
     // Create the Server Object ans Start it.
     server = new TCPServer();
     server.StartServer();
 }