Exemple #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 void SwnUnbind(TimeSpan timeout)
 {
     if (rpceClientTransport != null)
     {
         rpceClientTransport.Unbind(timeout);
         rpceClientTransport.Dispose();
         rpceClientTransport = null;
     }
 }
 /// <summary>
 /// Unbind and release the handle.
 /// </summary>
 public void UnBind()
 {
     if (RpceClientTransport != null)
     {
         RpceClientTransport.Unbind(RpceTimeout);
         RpceClientTransport.Dispose();
         RpceClientTransport = 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 void Unbind(TimeSpan timeout)
 {
     if (rpceClientTransport != null)
     {
         try
         {
             rpceClientTransport.Unbind(timeout);
             rpceClientTransport.Dispose();
         }
         catch
         {
         }
         finally
         {
             rpceClientTransport = null;
         }
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (RpceClientTransport != null)
         {
             RpceClientTransport.Dispose();
             RpceClientTransport = null;
         }
     }
 }
        /// <summary>
        /// Dispose method.
        /// </summary>
        /// <param name="disposing">
        /// True to release both managed and unmanaged resources.<para/>
        /// False to release unmanaged resources only.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Release managed resources.
                if (rpceClientTransport != null)
                {
                    rpceClientTransport.Dispose();
                    rpceClientTransport = null;
                }
            }

            // Release unmanaged resources.
        }
Exemple #6
0
        /// <summary>
        /// RPC bind to interface, using specified endpoint and authenticate provider.
        /// </summary>
        /// <param name="protocolSequence">
        /// RPC protocol sequence.
        /// </param>
        /// <param name="networkAddress">
        /// RPC network address.
        /// </param>
        /// <param name="endpoint">
        /// RPC endpoint.
        /// </param>
        /// <param name="transportCred">
        /// Credential to bind SWN server
        /// </param>
        /// <param name="secContext">
        /// RPC security provider.
        /// </param>
        /// <param name="authLevel">
        /// RPC authentication level.
        /// </param>
        /// <param name="timeout">
        /// Timeout
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// Thrown when there's existing connection.
        /// </exception>
        private bool RpcBind(
            string protocolSequence,
            string networkAddress,
            string endpoint,
            AccountCredential transportCred,
            ClientSecurityContext secContext,
            RpceAuthenticationLevel authLevel,
            TimeSpan timeout)
        {
            if (rpceClientTransport != null)
            {
                throw new InvalidOperationException("Connection has been established");
            }

            rpceTimeout         = timeout;
            rpceClientTransport = new RpceClientTransport();


            try
            {
                rpceClientTransport.Bind(
                    protocolSequence,
                    networkAddress,
                    endpoint,
                    transportCred,
                    SwnUtility.SWN_INTERFACE_UUID,
                    SwnUtility.SWN_INTERFACE_MAJOR_VERSION,
                    SwnUtility.SWN_INTERFACE_MINOR_VERSION,
                    secContext,
                    authLevel,
                    true,
                    rpceTimeout);
            }
            catch (Exception)
            {
                rpceClientTransport.Dispose();
                rpceClientTransport = null;
                throw;
            }

            return(true);
        }