Esempio n. 1
0
        /// <summary>
        /// RPCE unbind and disconnect.
        /// </summary>
        /// <param name="timeout">
        /// Timeout period.
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// Thrown when RPC has not been bind.
        /// </exception>
        public virtual void Unbind(TimeSpan timeout)
        {
            if (rpceClient.IsDisposed)
            {
                throw new InvalidOperationException("RPC connection has not been established.");
            }

            rpceClient.Disconnect(timeout);
            if ((receiveTask != null) && receiveTask.Status == TaskStatus.Running)
            {
                cancellationToken.Cancel();
                receiveTask = null;
            }
        }
        /// <summary>
        /// RPCE unbind and disconnect.
        /// </summary>
        /// <param name="timeout">
        /// Timeout period.
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// Thrown when RPC has not been bind.
        /// </exception>
        public virtual void Unbind(TimeSpan timeout)
        {
            if (rpceClient.IsDisposed)
            {
                throw new InvalidOperationException("RPC connection has not been established.");
            }

            rpceClient.Disconnect(timeout);
            if (receiveThread != null)
            {
                if (!receiveThread.Join(new TimeSpan(0, 0, 10)))
                {
                    receiveThread.Abort();
                }
                receiveThread = null;
            }
        }