/// <summary>
        /// Registers with the correct services
        /// </summary>
        public void Register()
        {
            try
            {
                // "Activate" the NameService singleton.
                objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri);

                // Retreive the directory of messaging channels
                IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory");

                // Retreive the Messaging Service channels we want to push to
                simulationMessageChannel = channelFactory.GetChannel("SimulationMessageChannel", ChannelMode.UdpMulticast);

                // Rebind the Simulator as the simulator remote facade server
                objectDirectory.Rebind(this, "SimulationServer");

                // Notify user of success
                SimulatorOutput.WriteLine("Connection to Name Service and Registration of Simulation Server as Simulator Facade Successful");

                // let clients know the sim is alive
                simulationMessageChannel.PublishUnreliably(SimulationMessage.Alive);
            }
            catch (Exception e)
            {
                SimulatorOutput.WriteLine("Error Registering With Remoting Services: " + e.ToString());
            }
        }
        /// <summary>
        /// Registers with the correct services
        /// </summary>
        public void Register()
        {
            try
            {
                // "Activate" the NameService singleton.
                objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri);

                // Retreive the directory of messaging channels
                IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory");

                // Retreive the Messaging Service channels we want to interact with
                if (simulationMessageChannel != null)
                    simulationMessageChannel.Dispose();
                simulationMessageChannel = channelFactory.GetChannel("SimulationMessageChannel", ChannelMode.UdpMulticast);

                // Listen to channels we wish to listen to
                simulationMessageChannelToken = simulationMessageChannel.Subscribe(this.messagingListener);

                // Rebind the Simulator as the simulator remote facade server
                objectDirectory.Rebind(this.client, this.client.Name());

                // get vehicle state channel
                if (vehicleStateChannel != null)
                    vehicleStateChannel.Dispose();
                vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

                // get observed obstacle channel
                if (observedObstacleChannel != null)
                    observedObstacleChannel.Dispose();
                observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

                // get observed vehicle channel
                if (observedVehicleChannel != null)
                    observedVehicleChannel.Dispose();
                observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

                // get vehicle speed channel
                if (vehicleSpeedChannel != null)
                    vehicleSpeedChannel.Dispose();
                vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

                // get the local road estimate channel
                if (localRoadChannel != null)
                    localRoadChannel.Dispose();
                localRoadChannel = channelFactory.GetChannel(LocalRoadEstimate.ChannelName + "_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

                // Notify user of success
                Console.WriteLine(DateTime.Now.ToString() + ": Connection to Name Service and Registration of Simulation Client Successful");
            }
            catch (Exception e)
            {
                // notify
                Console.WriteLine(DateTime.Now.ToString() + ": Error Registering With Remoting Services: " + e.ToString());
            }
        }
        /// <summary>
        /// Initializes communications with the outside world by means of remoting
        /// </summary>
        private void InitializeRemotingCommunications()
        {
            // Read the configuration file.
            RemotingConfiguration.Configure("..\\..\\App.config", false);
            WellKnownServiceTypeEntry[] wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes();

            // "Activate" the NameService singleton.
            objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri);

            // Bind the operational test faceade
            objectDirectory.Rebind(this, "OperationalTestFacade");

            // Retreive the directory of messaging channels
            IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory");

            // Retreive the Messaging Service channels we want to listen to
            rndfChannel = channelFactory.GetChannel("RndfNetworkChannel", ChannelMode.Bytestream);
            mdfChannel = channelFactory.GetChannel("MdfChannel", ChannelMode.Bytestream);
            positionChannel = channelFactory.GetChannel("PositionChannel", ChannelMode.Bytestream);
            testStringChannel = channelFactory.GetChannel("TestStringChannel", ChannelMode.Vanilla);

            // Create a channel listeners and listen on wanted channels
            channelListener = new MessagingListener();
            rndfToken = rndfChannel.Subscribe(channelListener);
            mdfToken = mdfChannel.Subscribe(channelListener);
            //positionToken = positionChannel.Subscribe(channelListener);
            testStringToken = testStringChannel.Subscribe(new StringListener());

            // Show that the navigation system is ready and waiting for input
            Console.WriteLine("   > Remoting Communication Initialized");
        }
        private void Connect(ObjectDirectory od)
        {
            // get the channel for the sim state
            IChannelFactory channelFactory = (IChannelFactory)od.Resolve("ChannelFactory");
            operationalStateChannel = channelFactory.GetChannel("OperationalSimState_" + SimulatorClient.MachineName, ChannelMode.Bytestream);

            // publish ourself to the object directory
            od.Rebind(this, "DynamicsSim_" + SimulatorClient.MachineName);
        }