示例#1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="ACantDisconnectReason"></param>
        /// <returns></returns>
        public Boolean DisconnectFromServer(out String ACantDisconnectReason)
        {
            Boolean ReturnValue = false;

            ACantDisconnectReason = "";
            try
            {
                if (FKeepAlive != null)
                {
                    TEnsureKeepAlive.StopKeepAlive();
                }

                if (FPollClientTasks != null)
                {
                    FPollClientTasks.StopPollClientTasks();
                    RemotingServices.Disconnect((MarshalByRefObject)FRemotePollClientTasks);
                }

                if (FRemote != null)
                {
                    ReturnValue = TRemoteBase.ClientManager.DisconnectClient(FClientID, out ACantDisconnectReason);
                    TRemoteBase.Disconnect();
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                throw;
            }
            catch (System.Runtime.Remoting.RemotingException)
            {
                throw;
            }
            return(ReturnValue);
        }
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="ACantDisconnectReason"></param>
        /// <returns></returns>
        public Boolean DisconnectFromServer(out String ACantDisconnectReason)
        {
            Boolean ReturnValue = false;

            ACantDisconnectReason = "";
            try
            {
                if (FPollClientTasks != null)
                {
                    FPollClientTasks.StopPollClientTasks();
                }

                ReturnValue = FClientManager.DisconnectClient(out ACantDisconnectReason);
            }
            catch (System.Net.Sockets.SocketException)
            {
                throw;
            }
            catch (System.Runtime.Remoting.RemotingException)
            {
                throw;
            }
            return(ReturnValue);
        }