Quite a few people have been asking how they can get their applications to talk to each other. More specifically, they have been wanting to know how to access information from another running application using .NET Remoting.
Not having done this before, I decided to take up the challenge and create a simple example of this approach. Thus, this code snippet and attached solution. I only posted relevant code in the snippet, but all projects and files can be found in the attached solution.
The SimpleServer form application runs a form having a textbox that I added some default text to, but you can change this value as you are testing the implementation of the Client form applications.
The SimpleClient1 and SimpleClient2 form applications run a form having a multiline textbox and a button to retrieve text from the SimpleServer application.
In both the SimpleServer and SimpleClient1 examples, the application loads the RemoteConfiguration settings from a configuration file. This is probably the best way to go, as it allows these settings to be modified (to change port, etc.) without the need to recompile the applications
The SimpleServer2 example has the RemoteConfiguration settings hardcoded, and demonstrates using TcpClientChannel as well as Activator.GetObject to communicate with the SimpleServer application.
EDIT: Note that I don't have more than one machine, so I could only perform local machine tests. If you try this on two machines, you will need (at a minimum) to adjust the SimpleServer.config file by removing the "rejectRemoteRequests" option, or setting it to "false".
<channel ref="tcp" port="33000" rejectRemoteRequests="false"/>
Edited 7 Years Ago by DdoubleD: n/a