Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to use .NET Remoting for inter-process communications


INTRODUCTION

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

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:

LanguageClient-side Project NameServer-side Project Name
Visual C#CSRemotingClientCSRemotingServer
Visual Basic.NETVBRemotingClientVBRemotingServer

Prerequisites

  • This sample application was created by using .Net Framework Remoting installed.

Tags

  • IPC
  • .NET Remoting

↑ Back to the top


More Information

What is All-In-One Code Framework?

All-In-One Code Framework shows most Microsoft development techniques by using code samples in different programming languages. Each example is carefully selected, composed, and documented to show one common code scenario. For more information about All-In-One Code Framework, visit the following Web site:


How to find more All-In-One Code Framework samples

To find more All-In-One Code Framework samples, you can simply click the following link:



↑ Back to the top


References

For more information about .NET Framework Remoting Architectur, visit the following websites:

For more information about .NET Framework Remoting Architecture, visit the following websites:
Rapid publishing disclaimer
Microsoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.

↑ Back to the top


Keywords: kb, kbsurveynew, kbrapidpub, atdownload, kbnomt, kbinfo, kbcodefx

↑ Back to the top

Article Info
Article ID : 2425649
Revision : 5
Created on : 6/18/2020
Published on : 6/18/2020
Exists online : False
Views : 232