Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Remoting: Disconnecting an object

Posted on 2004-04-07
4
Medium Priority
?
405 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 1500 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

810 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