Re: Synchronized objects

From: Ken Kolda (ken.kolda_at_elliemae-nospamplease.com)
Date: 01/28/05


Date: Thu, 27 Jan 2005 18:47:32 -0800

What you've seen so far probably mostly involves either using a config file
or the RemotingConfiguration class's static methods to identify certain
types as remoted. This is nice when you want transparency in your code as to
the source of the object -- you simply call "new MyObject()" and the
remoting system instantiates the object remotely for you. However, as you
noticed, it applies to all instances of a type, which, in your case, is not
what you want.

Luckily, there are other ways to instantiate remote objects that are
instance-specific (e.g. Activator.GetObject() and
Activator.CreateInstance()). In fact, there are several ways to get local
proxies to remote objects and the appropriate one to use depends on how you
plan to use the object in your clients and on your server. In your case, the
two main relevant questions are:

1) Does every client that connects need to access the same Foo instance
(foo4 in your case) or is each client going to be accessing its own, unique
instance of Foo on the server?

2) Does the server need to be able to access or receive events from the Foo
instances that are accessed by your client apps?

If you can answer those questions, I can steer you in the right direction
for how to set up your remoting framework.

Ken

"Roger Crawfis" <rcrawfis@columbus.rr.com> wrote in message
news:w78Kd.61443$re1.3177@fe2.columbus.rr.com...
>
> OK. I am a little lost on reading thru all of the rather simple examples
for
> remoting. It appears as if everything in .NET is type based, rather than
> instance based. I want a simple demo to synchronize a particular instance
of
> an object. Consider this simple scenario. I have a type foo, which has a
> public method bar. On my client, i want to create a local instance of foo,
> called foo1 which is totally disjoint from the server. I also want a
second
> instance of foo, foo2, which is a proxy to an instance on the server.
Assume
> the server also has two instances, foo3 and foo4. What I want is to attach
> foo2 to foo4. Everything else is a local vaiable. Do I need to create an
> entirely new component (type) to have remoting work properly? Any pointers
> to a simple example that allows this Calling foo1.bar() should be local,
but
> calling foo2.bar() should use the remote state. I do not particularly care
> at this moment, whether it copies over the remote object
(client-activated)
> or passes the method invocation to the server. In summary, I want
>
> foo foo1 = new foo(); // local instance
> foo foo2;
> foo2 = proxy for remote.foo4 instance;
>
> Roger
>
>



Relevant Pages

  • Synchronized objects
    ... On my client, i want to create a local instance of foo, ... instance of foo, foo2, which is a proxy to an instance on the server. ... entirely new component to have remoting work properly? ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Debugging Server Activated Remote Objects
    ... Having said that, you can do remote debugging, although it is a bit of ... Having said all of this though my recommendation to you for debugging ... this is a technique that I use with all my system service remoting ... I put all of the server code classes into a dll. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: A basic question on remoting.
    ... you can't just call older win32 based programs with remoting. ... server, have the server call into your win32 app somehow (com, command ... and provide them back to the client. ... if you need an example of a simple remote application, ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Getting at form or other data from singlecall thread on server?
    ... The issue wasn't getting data from client to server, ... data to/from my server's remote objects and data contained in my server. ... I'm starting to work with remoting and I have a question about how to get ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: scp/sftp ?
    ... >> using pscp instead. ... > remote server and e.g. have it list the files was beyond me :-( ... your local host to the remote one, or from the remote host to your local ... To copy a file called `foo' from your computer to a remote computer called ...
    (comp.sys.acorn.networking)

Loading