I have two applications IPC_Sender and IPC_Receiver. IPC Sender sends messages via IPC to the IPC_Receiver application. IPC_Reciever registers an IPC channel and a remotable object when it starts.

Everything works as expected when both applications are up and running, however, I get run time errors in the Sender if the receiver is not up and running. Before attempting to send messages I would like to check if the IPC_Reciever is up an running, by looking for the appropriate IPC Channel. I can't seem to find a good way to do this. Has anyone done this before?

Here is the code in the receiver that registers the channel:

Code:
            objSink = new BinaryServerFormatterSinkProvider();
            objSink.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            System.Collections.Hashtable objH = new System.Collections.Hashtable();
            objH.Add("Name", "MyApp");
            objH.Add("portName", "MyPort");
            objH.Add("exclusiveAddressUse", false);
            objH.Add("authorizedGroup", "Users");
            objServer = new IpcServerChannel(objH, objSink);

            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(objServer, false);

            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(RemoteObject), "RemoteObject", WellKnownObjectMode.Singleton);
Here is the code in the sender that sends the data:
Code:
            IRemoteableObject objRemote = null;
            object o = Activator.GetObject(typeof(IRemoteableObject),
                        @"ipc://MyPort/RemoteObject");
            
            objRemote = (IRemoteableObject) o;

            
            objRemote.SendMessage("Hello");
I was hoping for a way to check if the object returned from GetObject was null, but it never returns null, it always returns an object and the SendMessage call will throw an exception of "Failed to connect to an IPC Port: The system cannot find the file specified."

Any help would be greatly appreciated.