コード例 #1
0
        static void Main(string[] args)
        {
            System.Timers.Timer pingTimer = new System.Timers.Timer(TimeSpan.FromSeconds(5).TotalMilliseconds);
            pingTimer.Elapsed  += Ping;
            pingTimer.AutoReset = true;
            pingTimer.Start();

            var ThreadFromServer_cts = new CancellationToken();

            Task.Run(() => DispatcherNewsServer.SocketRecieve(ThreadFromServer_cts));
            var ThreadToClientSendList_cts = new CancellationToken();

            Task.Run(() => DispatcherClient.ServersListSend(ThreadToClientSendList_cts));

            Console.WriteLine("Write \"Exit\" to finish");
            string input = Console.ReadLine();

            while (input.ToUpper() != "EXIT")
            {
                //if (input.ToUpper() == "GET")
                //{
                //    reader.GetNews();
                //}
                input = Console.ReadLine();
            }
        }
コード例 #2
0
 private static void Ping(object sender, ElapsedEventArgs e)
 {
     DispatcherNewsServer.PingServs();
 }