예제 #1
0
 public void StopLocalServer()
 {
     // Note: doesn't stop accepting connections, simply stops broadcasting
     if (LanMode)
     {
         PingThread.Abort();
     }
 }
예제 #2
0
        public void Quit(string reason)
        {
            foreach (var channel in Channels.Values)
            {
                channel.SendQuit(this, reason);
            }

            ListenThread.Abort();
            PingThread.Abort();
            TcpClient.Close();
        }
예제 #3
0
        private void BeginPing()
        {
            int i = 0;

            foreach (var item in speedData)
            {
                PingThread pingThread = new PingThread(i, item.server);
                pingThread.callBack = ThreadCallBack;
                Thread t = new Thread(new ThreadStart(pingThread.PingIp));
                t.IsBackground = true;
                t.Start();
                i++;
            }
        }
예제 #4
0
        public bool Start()
        {
            if (!ListenThread.IsAlive)
            {
                Running = true;

                ListenThread.Start();
                PingThread.Start();

                return(true);
            }

            return(false);
        }
예제 #5
0
 /// <exception cref="System.Exception"></exception>
 public virtual void Test()
 {
     if (IsEmbedded())
     {
         // This test really doesn't make sense for MTOC, there
         // is no client to ping.
         return;
     }
     var dispatcher = ServerDispatcher();
     var pingThread = new PingThread
         (dispatcher);
     pingThread.Start();
     for (var i = 0; i < ItemCount; i++)
     {
         var item = new Item(i);
         Store(item);
     }
     Assert.AreEqual(ItemCount, Db().QueryByExample(typeof (Item
         )).Count);
     pingThread.Close();
 }
예제 #6
0
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            if (IsEmbedded())
            {
                // This test really doesn't make sense for MTOC, there
                // is no client to ping.
                return;
            }
            var dispatcher = ServerDispatcher();
            var pingThread = new PingThread
                                 (dispatcher);

            pingThread.Start();
            for (var i = 0; i < ItemCount; i++)
            {
                var item = new Item(i);
                Store(item);
            }
            Assert.AreEqual(ItemCount, Db().QueryByExample(typeof(Item
                                                                  )).Count);
            pingThread.Close();
        }
예제 #7
0
        /// <summary>
        /// 关闭当前窗口执行的事件
        /// </summary>
        private void CloseForm()
        {
            isStop = true;

            if (mutexRelease == 1)
            {
                ReleaseProtocolTracing();
                CSAMRunning = false;
            }
            try
            {
                if (PingThread != null)
                {
                    PingThread.Abort();
                }
            }
            catch { }
            foreach (Thread td in pingList)
            {
                try
                {
                    if (td != null)
                    {
                        td.Abort();
                    }
                }
                catch { }
            }
            foreach (Device dev in DeviceManger.deviceList)
            {
                if (dev.SendRexAnt)
                {
                    dev.SendRexAnt = false;
                }
            }
            SaveData();
            CSAMForm.Close();
            CSAMForm.Dispose(true);
        }
예제 #8
0
 public void End()
 {
     PingThread.Abort();
     SocketHelper.EndConnection();
     Program.LoginForm.Close();
 }