Re: Object Design Question



On Mon, 1 Aug 2005 18:09:26 -0400, Jason Callas wrote:

> After reviewing my design I realized that I cannot just serialize my object.
> This would create a COPY of it and send it to the Manager. Any changes the
> Manager made would never make it down to the client.
>
> How can I get a remote reference to the client? Can I just inherit from
> MarshalByRefObject?

Yes. In your known layer, declare the interface of the client object that
will have to be called by the server. The server having access to your know
layer DLL will then know what methods are available and won't need to have
access to the implementation of this class.

In the client application, implement this interface and make this class
inherit from MarshalByRefObject. Do not make this class serializable. Then
call your subscribtion method on the server passing your MarshalByRefObject
as a parameter. The server can now call methods on this MarshalByRefObject
object that actually remained on the client side (by passing the
MarshalByRefObject, i believe that you have actually sent a Transparent
Proxy object to the server, not a copy of the object itself).

Of course, unless you are using a bidirectional channel, this means that
the client will have to have registered a port to listen for server
callbacks and that this port must be opened in the client's firewall.
.



Relevant Pages

  • MarshalByRefObject/Remotingmit ref- und out-Parametern
    ... ich habe ein Verständnisproblem bzgl. MarshalByRefObject und Remoting in C#. ... Client und der Server in unterschiedlichen AppDomains laufen? ... Adresse der Variable an die Methode übergeben wird. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Please help with two processing talking to each other!!!
    ... not sending messages/data to a server and have it respond to it. ... The object on the client must derive from MarshalByRefObject. ... >> tell the Windows App that there's new data to look at. ...
    (microsoft.public.dotnet.languages.csharp)
  • [Serializable] vs. MarshalByRefObject in COM+ application
    ... - derived from MarshalByRefObject. ... I tested this by marking the class as (and not deriving ... server, it is hit when that method is invoked from the client. ...
    (microsoft.public.dotnet.framework.interop)
  • [Serializable] vs. MarshalByRefObject in COM+ application
    ... - derived from MarshalByRefObject. ... I tested this by marking the class as (and not deriving ... server, it is hit when that method is invoked from the client. ...
    (microsoft.public.dotnet.framework.remoting)
  • [Serializable] vs. MarshalByRefObject in COM+ application
    ... - derived from MarshalByRefObject. ... I tested this by marking the class as (and not deriving ... server, it is hit when that method is invoked from the client. ...
    (microsoft.public.dotnet.framework.component_services)

Loading