I have a client/server application that must use .NET Remoting (not WCF because the project is using Framework 2).
The following code (copied heavily from MSDN) works:
_clientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(_clientChannel, false);
IMyObject myObject= (IMyObject)
Activator.GetObject(typeof(IMyObject),
"ipc://MyServer/Address");
if ( myObject.Equals(null) )
Console.WriteLine("Error: unable to locate server.");
else
returnString = myObject.SomeMethod();
ChannelServices.UnregisterChannel(_clientChannel);
But what do these three lines do?
_clientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(_clientChannel, false);
...
ChannelServices.UnregisterChannel(_clientChannel);
_clientChannel doesn't get used anywhere afterwards in the working code. The working code also seems to work without those three lines. Can I get rid of them without losing functionality?