Solved

Remoting: Disconnecting an object

Posted on 2004-04-07
4
393 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now