Esempio n. 1
0
        public void StopTCpService()
        {
            TCPShellService.UnRegister(NetDataObserver);
            TCPShellService.Stop();

            TCPDataService.UnRegister(NetDataObserver);
            TCPDataService.Stop();
            IsTCPWorking = false;
        }
Esempio n. 2
0
        /// <summary>
        /// tcp数据交换初始化
        /// </summary>
        /// <param name="configure"></param>
        /// <returns></returns>
        public bool StartTCPService()
        {
            IsTCPWorking = false;
            // 同步方法,会阻塞进程,调用init用task
            TCPShellService.ConnectSync();
            TCPDataService.ConnectSync();
            TCPShellService.Register(NetDataObserver);
            TCPDataService.Register(NetDataObserver);
            if (TCPShellService.Connected && TCPShellService.Start() && TCPDataService.Connected &&
                TCPDataService.Start())
            {
                IsTCPWorking = true;
                return(IsTCPWorking);
            }

            return(IsTCPWorking);
        }