예제 #1
0
파일: Program.cs 프로젝트: haoas/CRMTPE
        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();
        }
예제 #2
0
파일: TCPService.cs 프로젝트: haoas/CRMTPE
 /// <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();
 }