Solved

Remoting: Disconnecting an object

Posted on 2004-04-07
4
397 Views
Last Modified: 2010-04-15
I have an object that receives events through remoting.  How can I "disconnect" this object so that the server cannot send any more events to it? (The same effect as closing my client application).
0
Comment
Question by:eternal_21
  • 3
4 Comments
 
LVL 10

Author Comment

by:eternal_21
ID: 10777152
I should mention that I am obtaining this object using,

  System.Runtime.Remoting.RemotingServices.Connect(System.Type, System.String).
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 10780982
I am not sure whether this can be applied to remoting, but generally disconnecting from event is done using -= operator. For example, if this code subscribes to some event:

        MouseEventsHandler handler;         // MouseEventsHandler is some delegate

        private void Form1_Load(object sender, System.EventArgs e)
        {
            ...
            // subscribe to m_MouseEvent event
            handler = new MouseEventsHandler(Form1_MouseEvent);   // keep this in class member if I want to unsubscribe later
            m_MessageFilter.m_MouseEvent += handler;
        }

To unsubscribe from this event I can use the following code:

        private void button1_Click(object sender, System.EventArgs e)
        {
            m_MessageFilter.m_MouseEvent -= handler;
        }
0
 
LVL 10

Author Comment

by:eternal_21
ID: 10781225
What I am looking for is a way to server the connection between the client and my server without having to unsubscribe to any events that my be in use... I will post some more code tomorrow - thanks for your advice Alex.
0
 
LVL 10

Author Comment

by:eternal_21
ID: 10852462
Sorry, AlexFM

This problem has been put on hold.  I will close this question for now, but select your answer as it may help others in the future.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question