Re: Synchronized objects
From: Roger Crawfis (rcrawfis_at_columbus.rr.com)
Date: 01/28/05
- Next message: msnews.microsoft.com: "Re: Encapsulation - Using Word On The Server"
- Previous message: Dave: "Re: Remoting vs Sockets for Performances ?"
- In reply to: Ken Kolda: "Re: Synchronized objects"
- Next in thread: Ken Kolda: "Re: Synchronized objects"
- Reply: Ken Kolda: "Re: Synchronized objects"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 04:51:51 GMT
Ken,
Please see my answers below. I am still somewhat in the design mode, and
more interested in learning the technology than really building anything.
For my current interests though I have provided answers.
"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:OwKqYPOBFHA.1400@TK2MSFTNGP11.phx.gbl...
> 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?
>
Several clients will need to access the same instance. But they may also
want to access foo5, foo6, etc., hence multiple instances on the server. I
was trying to use the Activator.GetObject(), but even from the
documentation, it is not clear whether it creates a new instance or simply
creates a real proxy. It is also not clear how you specify which specific
instance you are allowed to connect to and how to connect to it.
> 2) Does the server need to be able to access or receive events from the
> Foo
> instances that are accessed by your client apps?
>
OK. I have to bang my head against the wall three time to figure out which
one is the "server". My first thought is to say no, the client can handle
all of the method invocations, if this is what you meant.
clientFooProxy.barMethod() versus serverInstanceProxyToClient.barMethod().
Events though may be different. I do want the server to subscribe to events
coming from the client. This is also not clear. No I simply do events as
normal once all of the proxies are set up?
> If you can answer those questions, I can steer you in the right direction
> for how to set up your remoting framework.
>
Much appreciated. Hopefully this was specific enough.
> 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
>>
>>
>
>
- Next message: msnews.microsoft.com: "Re: Encapsulation - Using Word On The Server"
- Previous message: Dave: "Re: Remoting vs Sockets for Performances ?"
- In reply to: Ken Kolda: "Re: Synchronized objects"
- Next in thread: Ken Kolda: "Re: Synchronized objects"
- Reply: Ken Kolda: "Re: Synchronized objects"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|