About .NET Remoting Object
I have started learning .NET nearly two years ago. One of the topics which is hard to understand and confused many newbies is .NET Remoting Object.
.NET Remoting Object is often compared to ASP.NET Web Service as an alternative for building distributed system. There are many tutorials on the internet that show how to consume web service or how to create a web service. So we can see clearly how and where web service would plug into our applications. But for .NET Remoting Object, there are less tutorial. And I really don't know how can I make use of it in my application.
Here at my university, My friends and I (as a group of Microsoft Student Ambassadors) conduct a competition on AI programming. Competitors have to code his/her robot in C#. The robot can move in 4 directions and can place a bomb just like in the "Bomberman" game. 4 of these will be placed in the same map in each round and the last stand wins.
So what's the problem ?
The competitors have to code his/her robot as a derived class from "BaseAIBot" which is a class derived from "Thread". Then they have to compile their projects into DLLs. And have these DLLs run in our host application.
This is COMPLETE BLIND DEBUGGING !!
So the competitors must find someway debugging their programs. One approach is to have information dump into text file. This solution is OK but I really hate switching back and forth between the host application and the text file. So I decided to write a program which acts as a text terminal to receive text message from robot.
The root of problem
The problem is how can I send information across application domain or process ?
Yes, the answer is to use .NET Remoting Object.
I will have one object setup at my "Terminal" application and let the robot get this object and call "PushMessage(string)" method to add a message. After a message is pushed, the MessageReceived will be raised. And the UI will be updated.
This results as a program in the screen shot in the left.
I studied how to implement .NET Remoting from the two web pages below :
http://www.developer.com/net/net/article.php/2201701 - This covers the basics of .NET Remoting Object. What is it ? And when to use it.
http://www.codeproject.com/csharp/RemotingChatSample.asp - This is the working sample for application using .NET Remoting Object.