TCP Remoting Sample
This sample shows how to use the .NET Framework remoting architecture. In addition, it uses XML configuration files to specify available objects and server location information instead of hard-coding them into the binaries or putting the data into the system registry.
To get samples and instructions for installing them
Do one or more of the following:
On the Help menu, click Samples.
The Readme displays information about samples.
Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.
Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.
For more information, see Visual Studio Samples.
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.
To run this sample
Build the RemoteCustomer project.
Open the RemoteHost project and use F5 to start the RemoteHost application.
Launch another instance of Visual Studio and load the Client project, and then add a reference to the compiled RemoteCustomer application (RemoteCustomer.dll).
Use F5 to start the Client application.
To test on two different computers, you will have to change the client's .config file, changing localhost to an IP address or DNS name for the server computer. In addition, you might have to change the server's file if you change the port number. See the comments in both the client's .config file and the host's .config file for examples.
The sample contains three solutions, each with one project:
RemoteCustomer: the Server
RemoteHost: the Host
Client: the Client
The RemoteHost project contains a Windows Forms application that will read an XML configuration file that is named Host.exe.config to make available the classes defined in the RemoteCustomer project. For a production application, you might want to host the class library (RemoteCustomer.dll) in a Windows service.