You're right - I always forget you can name the channels.  As for building a
custom formatter/provider versus something else, it might be a lot easier to
just agree on the user of a different port to differentiate formatter types
assuming you're using wellknown objects.

For example, the server might do this:

// Setup the http/soap channel
IDictionary chanProps = new ListDictionary();
chanProps["port"] = 998;
chanProps["name"] = "httpsoapchan";

IChannel chan = new HttpChannel( chanProps, new
SoapClientFormatterSinkProvider(), new SoapServerFormatterSinkProvider() );
ChannelServices.RegisterChannel(chan);

// Setup the http/binary channel
chanProps = new ListDictionary();
chanProps["port"] = 999;
chanProps["name"] = "httpbinchan";
chan = new HttpChannel( chanProps, new BinaryClientFormatterSinkProvider(),
new BinaryServerFormatterSinkProvider() );
ChannelServices.RegisterChannel(chan);

// Make the Foo type available for remoting.
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Foo), "foosrv",
WellKnownObjectMode.Singleton);

Clients that want to use http/soap to talk to the server would just register
the default http channel and use RemotingServices.Connect(typeof(Foo),
"http://blah:998/foosrv";) to talk to the server.  Clients wanting to use
http/binary would instead setup the http/binary channel/formatter and use
http://blah:999/foosrv to talk to the server.

It took me ~90 seconds to tweak an existing sample client/server to test
this out without using separate appdomains in the server.

-Mike
http://staff.develop.com/woodring
http://www.develop.com/devresources

----- Original Message -----
From: "Ming Chen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 4:24 PM
Subject: Re: [ADVANCED-DOTNET] remoting with http/soap and http/binary
channels within the same client app instance


  From .NET Framework document, you can have multiple channels as long
as they have different names. It has nothing to do with the channel
type.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to