public void StopTCpService() { TCPShellService.UnRegister(NetDataObserver); TCPShellService.Stop(); TCPDataService.UnRegister(NetDataObserver); TCPDataService.Stop(); IsTCPWorking = false; }
/// <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); }