Question on .Net Remoting Connection

G

Guest

Hi,

In trying to understanding the .Net Remoting plumbing I have a questions and
wondering if anyone can help me? I have read Rammer's excellent book but
still having got all the answers.

This is what I have and I know of.

I have a client program, Client, and a server program, Server, which hosts
..Net Remotable classes - can be CAO or Singleton SAO. Let's use Singleton and
call this MyServFactory class and I am using a IPC channel for connection.

This class MyServFactory can manufacture objects of a number of
MarshalByRefObject classes and one of them is MyClass.

I can connect to the server by getting an instance of MyServFactory and that
returns to me a transparent proxy with which I can acquire an instance of
MyClass.

Questions:
==========
1) Is MyClass CAO?
2) When I access methods and properties of MyClass, does the .net remoting
message travel along the connection I made when I connected to the
MyServFactory even though I am not operating on the MyServFactory object?
3) If after acquiring an instance of MyClass, can I now dispose (one way or
another) the object MyServFactory and just keeping instances of MyClass and
objects of other classes it manufactures?
4) If I can, what is there to maintain the connectivity between the client
and the server? Are these pieces of information encoded in the ObjRef?

Thanks.

Leon
 
D

Dave Sexton

Hi Leon,

In the future, you may get better responses if you post remoting questions
to the microsoft.public.dotnet.framework.remoting newsgroup, but I've
attempted to answer your questions below.

I have a client program, Client, and a server program, Server, which hosts
.Net Remotable classes - can be CAO or Singleton SAO. Let's use Singleton
and
call this MyServFactory class and I am using a IPC channel for connection.

This class MyServFactory can manufacture objects of a number of
MarshalByRefObject classes and one of them is MyClass.

I can connect to the server by getting an instance of MyServFactory and
that
returns to me a transparent proxy with which I can acquire an instance of
MyClass.

Questions:
==========
1) Is MyClass CAO?

Instances of MyClass that are created by MyServFactory are not activated by
the client in the remoting sense, although they are technically created on
demand by the client. These instances are not "well-known" and cannot be
created using the Activator class, the "new" keyword or by the
RemotingServices.Connect method. MyClass can, however, be registered with
the remoting framework as a well-known CAO but the instances served by the
MyServFactory class will not be CAO.
2) When I access methods and properties of MyClass, does the .net remoting
message travel along the connection I made when I connected to the
MyServFactory even though I am not operating on the MyServFactory object?

I believe that the base url supplied to the client proxy, which will be used
for subsequent calls to the MyClass object, is the base url of the
connection on which the MyClass object was requested from the server.

Technically, this may not be the same "connection" since remoting uses a
disconnected (stateless) architecture, for the most part, but I believe that
the protocol/host/port combination will be the same.
3) If after acquiring an instance of MyClass, can I now dispose (one way
or
another) the object MyServFactory and just keeping instances of MyClass
and
objects of other classes it manufactures?

Yes. The lifetimes of MyClass instances will be managed separately. If the
MyServFactory singleton is disconnected from remoting services, MyClass
proxies acquired through the MyServFactory instance will still be active as
long as the MyClass instances' lifetime services (ILease) or any sponsors
permit and the channel used to communicate with the objects is still
listening on the server.
4) If I can, what is there to maintain the connectivity between the client
and the server? Are these pieces of information encoded in the ObjRef?

You can maintain "connectivity" using sponsors or by simply invoking members
on the remote object, although you'd really not be maintaining
"connectivity", you'd just be keeping the object alive. The availability of
remoting objects, in this sense, has to do with lifetime management.

"System.Runtime.Remoting.Lifetime Namespace"
http://msdn2.microsoft.com/en-us/library/system.runtime.remoting.lifetime.aspx
 
G

Guest

Thanks Dave for the answers and also your referral to the appropriate group
for this subject.

:

Instances of MyClass that are created by MyServFactory are not activated by
the client in the remoting sense, although they are technically created on
demand by the client. These instances are not "well-known" and cannot be
created using the Activator class, the "new" keyword or by the
RemotingServices.Connect method. MyClass can, however, be registered with
the remoting framework as a well-known CAO but the instances served by the
MyServFactory class will not be CAO.
Correct me if I am wrong, isn't different type of .Net Remoting object
requiring different treatment of lifetime lease management?

I understand that MyClass will not support the creation schemes you have
managed because I have not registered them.

If it is not a CAO, what kind of server object is this? What lifetime lease
management scheme is required. If it is not CAO, would I still need to invoke
sponsors?
I believe that the base url supplied to the client proxy, which will be used
for subsequent calls to the MyClass object, is the base url of the
connection on which the MyClass object was requested from the server.

Technically, this may not be the same "connection" since remoting uses a
disconnected (stateless) architecture, for the most part, but I believe that
the protocol/host/port combination will be the same.
So I presume if the original connection use IPC channel, subsequent call to
other object on the server, like MyClass which is not registered will use the
same channel. Is this correct?

What would happen if MyServFactory2, in addition to MyServerFactory, is
registered to use TCP instead of IPC channel and it also creates MyClass
objects. So now we have 'two types' of MyClass objects distinguished by the
channel type. Is this a correct observation?

What I am trying to understand is the channel usage of these 'unregistered'
objects as they are not .Net Remotable object in a sense, aren't they?

Thanks.

Leon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top