Game Development Reference
In-Depth Information
_channel = new TcpChannel((int)PortField.Value);
ChannelServices.RegisterChannel(_channel);
_remotedLogic = new AlertObjectTool.AlertObjectToolLogic();
_remotedLogicRef = RemotingServices.Marshal(_remotedLogic,
“AlertObjectToolLogic”);
}
else
{
ActionButton.Text = “Start Listening”;
RemotingServices.Disconnect(_remotedLogic);
_remotedLogicRef = null;
_remotedLogic = null;
ChannelServices.UnregisterChannel(_channel);
}
}
Alert Object Remoting Example
With the specific tool logic published on a remoting channel, we can now request
a reference to the proxy object and begin invoking calls.
Here is the code for a remoting entry point that invokes the specific tool logic
using a proxy object:
// A reference to the tool logic proxy
private IAlertObjectToolLogic _logicProxy = null;
private void ActionButtonClick(object sender, System.EventArgs e)
{
if (ActionButton.Text.Equals(“Connect to Proxy”))
{
ActionButton.Text = “Release Proxy”;
_logicProxy =
(IAlertObjectToolLogic)Activator.GetObject(typeof(IAlertObjectToolLogic),
“tcp://localhost:” + ((int)PortField.Value).ToString() + “/AlertObjectToolLogic”);
TestFirstButton.Enabled = true;
TestSecondButton.Enabled = true;
TestThirdButton.Enabled = true;
Search Nedrilad ::




Custom Search