.NET Remoting and Delphi - .NET Remoting Basics
(Page 4 of 11 )
The following sections provide an overview of the .NET remoting technology.
Architectural Overview
The .NET Remoting architecture is extremely flexible and provides developers with a framework that is easy to customize and extend.
This section provides you with a brief description of the most important elements of the framework and introduces a few concepts only present in .NET Remoting.
Application Domains
Application Domains are at the core of the remoting infrastructure and represent the boundaries for Interprocess Communication (IPC).
In classical Win32, Windows creates a new process when an executable is launched. Processes are the lowest level of isolation and cannot directly share memory between each other. Memory addresses are process relative: Pointers to memory in one process are meaningless to another.
Application Domains, or AppDomains, are to .NET what processes are to Win32. AppDomains provide a more granular level of separation and better security than Win32 processes.
You can run several application domains in a single process with the same level of isolation that would exist in separate processes, but without incurring the additional overhead of making cross-process calls or switching between processes. Figure 29.6 illustrates this concept.
.NET Remoting is necessary to make objects in one domain communicate with those hosted in another, regardless of the domains being in the same process or in processes running on different machines.
The System.Runtime.Remoting Namespace
In order to develop applications that use .NET Remoting, you will need to reference the namespace System.Runtime.Remoting in both your clients and servers.

Figure 29.6
Cross AppDomain communication using .NET Remoting.
The System.Runtime.Remoting namespace and those depending on it provide classes and interfaces that allow developers to create and configure distributed applications.
The RemotingConfiguration Class
The RemotingConfiguration class contains static class methods for interfacing with configuration settings and register objects so that they can be remotely invoked.
The following snippet of code registers the class TBankManager:
RemotingConfiguration.RegisterWellKnownServiceType(
typeOf(TBankManager),
'BankManager.soap',
WellKnownObjectMode.Singleton);
More about this method is explained in the section "Server Activation."
Remoting settings can be programmatically set or can be read from external configuration files.
The RemotingConfiguration.Configure() method allows developers to configure the Remoting infrastructure through the use of XML formatted configuration files.
This is how you would use it:
RemotingConfiguration.Configure('MyConfiguration.config');
The configuration files can contain information such as the networking protocol to use for remote communication, the TCP or HTTP port used, the message formatting type (SOAP or binary), and more.
Note - Refer to the section called "Remoting Settings Schema" in the MSDN Online Library for more information at http://msdn.microsoft.com/library/default.asp?url=/library/enus/cpgenref/html/gnconRemotingSettingsSchema.asp
This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.
Buy this book now. |
Next: The ChannelServices Class >>
More .NET Articles
More By Xavier Pacheco