This article describes an All-In-One Code Framework sample that is available for download. This code sample demonstrates how to use .NET Remoting for inter-process communications.
Difficulty level
.NET remoting allows an application to make a remotable object available across remoting boundaries, which includes different appdomains, processes or even different computers connected by a network. .NET Remoting makes a reference of a remotable object available to a client application, which then instantiates and uses a remotable object as if it were a local object. However, the actual code execution happens at the server-side. Any requests to the remotable object are proxied by the .NET Remoting runtime over Channel objects that encapsulate the actual transport mode, including TCP streams, HTTP streams and named pipes. As a result, by instantiating proper Channel objects, a .NET Remoting application can be made to support different communication protocols without recompiling the application. The runtime itself manages the act of serialization and marshalling of objects across the client and server appdomains.
In the code sample, CSRemotingServer (or VBRemotingServer) is a .NET Remoting server project. It contains the following remotable objects:
RemotingShared.ClientActivatedObject defined in the shared assembly CSRemotingSharedLibrary.DLL or VBRemotingSharedLibrary.DLL
ClientActivatedObject is a client-activated object (CAO) for .NET Remoting. Client-activated objects are created by the server and their lifetime is managed by the client. In contrast to server-activated objects, client-activated objects are created as soon as the client calls "new" or any other object creation methods. Client-activated objects are specific to the client, and objects are not shared among different clients; object instance exists until the lease expires or the client destroys the object.
CSRemotingClient (or VBRemotingClient) is the .NET Remoting client project. It accesses the remotable objects (SingleCall objects or Singleton objects or client-activated objects) exposed by the .NET Remoting server project CSRemotingServer (or VBRemotingServer).
You can configure .NET Remoting using an application configuration file or in code. Both methods are demonstrated in the code samples.
Tags
Difficulty level

Download information
To download this code sample, click the following link:Technical overview
.NET remoting provides an abstract approach to interprocess communication that separates the remotable object from a specific client or server application domain and from a specific mechanism of communication..NET remoting allows an application to make a remotable object available across remoting boundaries, which includes different appdomains, processes or even different computers connected by a network. .NET Remoting makes a reference of a remotable object available to a client application, which then instantiates and uses a remotable object as if it were a local object. However, the actual code execution happens at the server-side. Any requests to the remotable object are proxied by the .NET Remoting runtime over Channel objects that encapsulate the actual transport mode, including TCP streams, HTTP streams and named pipes. As a result, by instantiating proper Channel objects, a .NET Remoting application can be made to support different communication protocols without recompiling the application. The runtime itself manages the act of serialization and marshalling of objects across the client and server appdomains.
In the code sample, CSRemotingServer (or VBRemotingServer) is a .NET Remoting server project. It contains the following remotable objects:
RemotingShared.SingleCallObject
SingleCallObject is a server-activated object (SAO) with the "SingleCall" instancing mode. Such objects are created on each method call and objects are not shared among clients. State should not be maintained in such objects because they are destroyed after each method call.RemotingShared.SingletonObject
SingletonObject is a server-activated object (SAO) with the "Singleton" instancing mode. Only one object will be created on the server to fulfill the requests of all the clients; that means the object is shared, and the state will be shared by all the clients.RemotingShared.ClientActivatedObject defined in the shared assembly CSRemotingSharedLibrary.DLL or VBRemotingSharedLibrary.DLL
ClientActivatedObject is a client-activated object (CAO) for .NET Remoting. Client-activated objects are created by the server and their lifetime is managed by the client. In contrast to server-activated objects, client-activated objects are created as soon as the client calls "new" or any other object creation methods. Client-activated objects are specific to the client, and objects are not shared among different clients; object instance exists until the lease expires or the client destroys the object.CSRemotingClient (or VBRemotingClient) is the .NET Remoting client project. It accesses the remotable objects (SingleCall objects or Singleton objects or client-activated objects) exposed by the .NET Remoting server project CSRemotingServer (or VBRemotingServer).
You can configure .NET Remoting using an application configuration file or in code. Both methods are demonstrated in the code samples.
Technology category
- Interprocess Communications
Languages
This code sample contains the following programming languages:Language | Client-side Project Name | Server-side Project Name |
Visual C# | CSRemotingClient | CSRemotingServer |
Visual Basic.NET | VBRemotingClient | VBRemotingServer |
Prerequisites
- This sample application was created by using .Net Framework Remoting installed.
Tags
- IPC
- .NET Remoting