.NET Remoting with Multiple Channels

B

breeto

If you've configured .NET Remoting to use more than one channel of the
same type, for example two TcpClientChannels with unique names, when
you want to create a proxy to a remote object how do you specify which
channel you want that proxy to use?

Thanks in advance.
 
D

Dave Sexton

Hi Breet,
how do you specify which
channel you want that proxy to use

You don't. The framework will choose the local channel to use as a
transport when invoking a message on a remote object. The framework will
create a channel for outbound messages if one is not already registered when
a method on the remote object is invoked. If you require call-backs from
the remote object then you must register a channel yourself that is
compatible with the target channel on the server.

Registering multiple channels of the same type on the client, named or
unnamed, is unnecessary in most cases, however if you have multiple proxies
in the same application that each require different channel sinks then you
can separate the proxies into different AppDomains, within the same process,
since the scope of a channel is the AppDomain in which it was registered.

- Dave Sexton
 
B

breeto

Thank you for the reply, but I have to wonder why the remoting
framework would allow us to register multiple channels, especially
channels of the same type, if it won't allow us to select which channel
to use for a given remote object.

For example, say you have a single application that communicates with
two different servers (remote objects), one server uses a secure TCP
channel and the other a non-secure TCP channel. When you create the
remote object references in the client how is the determination made
whether to use the secure or non-secure channel?
 
D

Dave Sexton

Hi Breeto,
For example, say you have a single application that communicates with
two different servers (remote objects), one server uses a secure TCP
channel and the other a non-secure TCP channel. When you create the
remote object references in the client how is the determination made
whether to use the secure or non-secure channel?

The port segment of the Uri would be different between the registration of
both objects. If you want to publish several remote objects using multiple
ports you can do so in remoting. Of course each object is then accessible
by any registered channel and therefore any of the registered protocol/port
combinations.

Server-side registration:

Register HttpChannel:81
Register TcpChannel:8080
Register TcpChannel:8081 (Secured)

Register remote object: object1
Register remote object: object2

Valid URIs:

http:// localhost:81/object1
http:// localhost:81/object2
tcp://localhost:8080/object2
tcp://localhost:8081/object1
tcp://localhost:8080/object1
tcp://localhost:8081/object2

The remoting framework will choose an appropriate client channel or create
one if one has not been registered. For secure channels you would have to
register the client channel yourself to specify the security parameters and
credentials, unless the framework just creates a channel with the default
credentials but I doubt that since it would not be very secure for the
framework to assume the default credentials may be sent without explicit
consent from the application.

Use multiple AppDomains on the server if you require that a published object
only be accessible via specific channel sinks or remoting channels
(protocol/port combinations).
Use multiple AppDomains on the client if you require proxies to use specific
channel sinks or remoting channels (protocol/local port combinations).

- Dave Sexton
 

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