Update on the number of channels: it works, you just have to code a bit =
more.=20
Here is an example using tcp channels, one on port 100 and another on =
101.=20
Hope it brings you further.=20
Regards,
Ziga
//Declaring the first channel
System.Runtime.Remoting.Channels.Tcp.TcpChannel cnl1 =3D new =
System.Runtime.Remoting.Channels.Tcp.TcpChannel(100);
//Preparing all properties for second channel
Hashtable Props =3D new Hashtable();
Props.Add("name", "OtherChannel"); //give the channel a different name, =
or it won't work
Props.Add("port", 101); //assign it a port of your choice
//Use appropriate sinks. Here I declare them independently for clarity, =
otherwise just include the new... statements in the cnls constructor
System.Runtime.Remoting.Channels.IClientChannelSinkProvider cs =3D new =
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();
System.Runtime.Remoting.Channels.IServerChannelSinkProvider ss =3D new =
System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider();
//Construct the second channel
System.Runtime.Remoting.Channels.Tcp.TcpChannel cnl2 =3D new =
System.Runtime.Remoting.Channels.Tcp.TcpChannel(Props, cs, ss);
//Register both channels
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(cnl1);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(cnl2);
[quoted text, click to view] "Ziga Jakhel" <ziga.jakhel(a)ius-software.si> wrote in message =
news:exBx3DiQDHA.3664@tk2msftngp13.phx.gbl...
> 1) If you want the application to be a server, accessible from another
> object, you will have to register it with a known port number. If you
> explicitly need a receiving and a sending channel, register a server =
channel
> and a client channel.
>=20
> In your example, registering the channel without a port number would =
work
> for the client configuration, but only if the client would not be =
receiving
> callbacks from the server. (You can also get this piece of info from
> IntelliSense when delcaring a channel).
> To enable that you should declare the channel at port 0, which means =
that
> the computer will use any available port, with two-way communication
> enabled; or declare it (as a two-way channel) with a known port =
number.
>=20
> 2) I think you can have a http channel and a tcp channel, but not two
> channels of the same type in a single application. I am not completely =
sure
> of this, but have also not been able to get it to work.
>=20
> All in all, if you want both your applications to be accessible as =
servers,
> just register each of them with a single two-way channels on a known =
port.
> This should do the trick more then nicely.
>=20
> Regards,
>=20
> Ziga Jakhel, MCAD.NET
> IUS SOFTWARE d.o.o.
>
www.ius-software.si >=20
>=20
>=20
> "Stephan Moeller" <zeus1001@123box.co.uk> wrote in message
> news:032a01c3420d$edd0d480$a001280a@phx.gbl...
> Hi,
> I=B4m writing a distributed application, where the client
> could by a server and the server could be the client.
> So both appliactions have distributed methods.
> Now I tried to open two http channels on each computer
> and got an exception in the second line:
>=20
> HttpChannel channel =3D new HttpChannel();
> ChannelServices.RegisterChannel(channel);
>=20
>=20
> -> a http channel already exists
>=20
> What=B4s the problem by doing it that way. It should
> be possible two open to channels in one appication.
>=20
> Thanx and regards
>=20
> Stephan
>=20