C# Remote Client Object
The Client application for calling Remote Object's method in C# is pretty simple and straight forward. The .NET Remoting System will intercept the client calls, forward them to the remote object, and return the results to the client. The Client Application have to register for the Remote Type also.
Here, in the Client application in C# , creating an instance of the Remote Type , RemoteTime Object , and call the method getTime() . Additionally it uses the configuration file Client.exe.config for the communication information for the Remoting Framework.
Copy and paste the above C# source code into a file and save it as Client.cs .
We have to create additional configuration file to provide the communication information to the Client Object . The configuration file is a an XML structured file. We can specify the Remote Type , Channel , port for communication etc. through the configuration file.
Click here to download Client.exe.config
Compile the class file Client.cs using the command-line tools that ship with the Visual Studio SDK .
At the command prompt type the following command:
csc /r:RemoteTime.dll Client.cs
After you compile the Client.cs , you will get a file called Client.exe in the directory where your compiler resides.
If your file Client.cs and RemoteTime.dll is residing in c:\src then you should type command like the following :
csc /r:c:\src\RemoteTime.dll c:\src\Client.cs