コード例 #1
0
        }         //ByRefCallBack()

        public void ByValCallBack(IAsyncResult ar)
        {
            try
            {
                ByValDelegate d   = (ByValDelegate)((AsyncResult)ar).AsyncDelegate;
                ForwardByVal  fbv = d.EndInvoke(ar);
                Console.WriteLine("Forwarded message: {0}", fbv.Message);
                m_ResetEvent.Set();
            }//try
            catch (Exception e)
            {
                Console.WriteLine("Exception in ByValCallBack(): {0}", e.ToString());
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }//catch
            finally
            {
                //Unregister the channels so app can execute again.
                if (m_HttpChannel != null)
                {
                    ChannelServices.UnregisterChannel(m_HttpChannel);
                }//if

                if (m_TcpChannel != null)
                {
                    ChannelServices.UnregisterChannel(m_TcpChannel);
                } //if
            }     //finally
        }         //ByRefCallBack()
コード例 #2
0
        }     //ByRefCallBack()

        public void ByValCallBack(IAsyncResult ar)
        {
            try
            {
                ByValDelegate d   = (ByValDelegate)((AsyncResult)ar).AsyncDelegate;
                ForwardByVal  fbv = d.EndInvoke(ar);
                Console.WriteLine("Forwarded message: {0}", fbv.Message);
                m_ResetEvent.Set();
            }//try
            catch (Exception e)
            {
                Console.WriteLine("Exception in ByValCallBack(): {0}", e.ToString());
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            } //catch
        }     //ByRefCallBack()