Carl Heller
2009-02-17 09:36:06 UTC
I have a very basic question about remoting. Given the following code:
public static int Main(string [] args)
{
//select channel to communicate with server
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
RemoteObject remObject =
(RemoteObject)Activator.GetObject(typeof(RemotingSamples.RemoteObject),"tcp://localhost:8085/RemotingServer");
if (remObject==null)
Console.WriteLine("cannot locate server");
else
remObject.ReplyMessage("You there?");
return 0;
}
1. What is the purpose of creating and registering a channel? Logically, I
understand that there must be a TCP channel to send the information along,
but I cannot see it being used at all in the call to the remoting server?
ie: why is there no:
RemoteObject remObject =
(RemoteObject)Activator.GetObject(typeof(RemotingSamples.RemoteObject),
"tcp://localhost:8085/RemotingServer", chan);
2. If I create a named channel, how do I specify that the named channel is
used for a given remoting call, instead of the default channel named tcp?
Thank you,
Carl.
public static int Main(string [] args)
{
//select channel to communicate with server
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
RemoteObject remObject =
(RemoteObject)Activator.GetObject(typeof(RemotingSamples.RemoteObject),"tcp://localhost:8085/RemotingServer");
if (remObject==null)
Console.WriteLine("cannot locate server");
else
remObject.ReplyMessage("You there?");
return 0;
}
1. What is the purpose of creating and registering a channel? Logically, I
understand that there must be a TCP channel to send the information along,
but I cannot see it being used at all in the call to the remoting server?
ie: why is there no:
RemoteObject remObject =
(RemoteObject)Activator.GetObject(typeof(RemotingSamples.RemoteObject),
"tcp://localhost:8085/RemotingServer", chan);
2. If I create a named channel, how do I specify that the named channel is
used for a given remoting call, instead of the default channel named tcp?
Thank you,
Carl.