Pages

Wednesday, 16 May 2012

COM Family: COM+ and DCOM, Interop, RPC and TLB

Microsoft COM (Component Object Model) technology enables different software components to communicate. It was introduced by Microsoft in 1993. The family of COM technologies includes COM+, Distributed COM (DCOM) and ActiveX Controls.

COM provides interoperability. COM allows reuse of objects with no knowledge of their internal implementation.COM objects can be used with all .NET languages through .NET COM Interop.

COM interfaces have bindings in several languages, such as C, C++, Visual Basic, Delphi, and several of the scripting languages implemented on the Windows platform. All access to components is done through the methods of the interfaces.

Type Library in COM (.tlb file)

First, you must create a type library for the assembly. A type library is the COM equivalent of the metadata contained within a .NET assembly. Type libraries are generally contained in files with the extension .tlb. A type library contains the necessary information to allow a COM client to determine which classes are located in a particular server, as well as the methods, properties, and events supported by those classes. Each component or dll file must contain type library.

COM Interop

COM Interop is a technology included in the .NET CLR that enables COM objects to interact with .NET objects, and vice versa. COM Interop allows COM developers to access managed objects as easily as they access other COM objects.

The .NET Framework creates a type library and special registry entries when a component (compiled in the form of DLL) is registered. It provides a specialized utility that exports the managed types into a type library and registers the managed component as a traditional COM component. When the type is instantiated through COM, the .NET CLR is the actual COM object that executes and it merely marshals any method calls or property access to the type implementation.

Reference Counting, Pooling and Memory Management in COM:

The COM specifications require a technique called reference counting to ensure that individual objects remain alive as long as there are clients which have acquired access to one or more of its interfaces and, conversely, that the same object is properly disposed of when all code that used the object have finished with it and no longer require it. A COM object is responsible for freeing its own memory once its reference count drops to zero. Pooling for objects can also be set for different components.

RPC (Remote Procedure Call)

Microsoft Remote Procedure Call (RPC) is a powerful technology for creating distributed client/server programs. RPC is an interprocess communication technique that allows client and server software to communicate.

dcomcnfg:

To access settings on a computer running Windows 2000, Windows XP and earlier, click Start > Run, and type "dcomcnfg". (Click NO for any warning screens that appear.) To access DCOM settings on a computer running Windows Vista or later, click Start, type "dcomcnfg", right-click "dcomcnfg.exe" in the list, and click "Run as administrator".

COM is very similar to other component software interface technologies, such as CORBA and Java Beans, although each has its own strengths and weaknesses.

COM Family:

COM+: COM+ is the name of the COM-based services and technologies first released in Windows 2000. It provides  distributed transactions, resource pooling, disconnected applications, event publication and subscription, better memory and processor (thread) management.

DCOM: DCOM isDistributed COM. DCOM uses RPC mechanism for communication. It allows COM components to communicate across network boundaries.It provides load balancing.COM installation and execution is done in its clien machine where DCOM is intalled and run on selected server machine.

DCOM is generally equivalent to the Common Object Request Broker Architecture ( CORBA ) in terms of providing a set of distributed services. But unlike CORBA, which runs on many operating systems, DCOM is currently implemented only for Windows.

Migrate from COM application

Although calling a COM component from managed code is simple, you should not consider this a permanent solution for most applications. Over the long run, you'll want to migrate heavily used components to native .NET code. This will provide you with the full range of .NET capabilities, as well as make your code faster by eliminating the RCW layer.

Decline of COM

Several of the services that COM+ provides have been largely replaced by recent releases of .NET. For example, the System.Transactions namespace in .NET provides the TransactionScope class, which provides transaction management without resorting to COM+. Similarly, queued components can be replaced by Windows Communication Foundation with an MSMQ transport.

No comments:

Post a Comment

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.