Пример #1
0
        /// <summary>
        ///		同步创建连接
        /// </summary>
        /// <param name="timeout"></param>
        public void Connect(int timeout)
        {
            var a = new SyncInvoker <Exception>();

            BeginConnect(a.Callback);
            if (!a.Wait(timeout))
            {
                throw new RpcException(RpcErrorCode.ConnectionTimeout, RemoteUri.ToString(), "Connection timeout", null);
            }
        }
Пример #2
0
        /// <summary>
        ///		连接,使用参数专递的超时时间
        /// </summary>
        /// <param name="connectionTimeout">超时时间</param>
        public void Connect(int connectionTimeout)
        {
            var a = new SyncInvoker <Exception>();

            BeginConnect(a.Callback);
            a.Wait(_timeout);
            if (a.Context != null)
            {
                throw a.Context;
            }
        }