In-process, Out-of-process, and Remote Servers

From RAD Studio
Jump to: navigation, search

Go Up to COM Servers


With COM, a client does not need to know where an object resides, it simply makes a call to an object's interface. COM performs the necessary steps to make the call. These steps differ depending on whether the object resides in the same process as the client, in a different process on the client machine, or in a different machine across the network. The different types of servers are known as:

In-process server

A library (DLL) running in the same process space as the client, for example, an ActiveX control embedded in a Web page viewed under Internet Explorer or Netscape. Here, the ActiveX control is downloaded to the client machine and invoked within the same process as the Web browser.The client communicates with the in-process server using direct calls to the COM interface.

Out-of-process server (or local server)

Another application (EXE) running in a different process space but on the same machine as the client. For example, an Excel spreadsheet embedded in a Word document are two separate applications running on the same machine.The local server uses COM to communicate with the client.

Remote server

A DLL or another application running on a different machine from that of the client. For example, a Delphi database application is connected to an application server on another machine in the network.The remote server uses distributed COM (DCOM) to access interfaces and communicate with the application server.



As shown in the following figure, for in-process servers, pointers to the object interfaces are in the same process space as the client, so COM makes direct calls into the object implementation.

In-process server

Note: This is not always true under COM+. When a client makes a call to an object in a different context, COM+ intercepts the call so that it behaves like a call to an out-of-process server (see below), even if the server is in-process.

As shown in the following figure, when the process is either in a different process or in a different machine altogether, COM uses a proxy to initiate remote procedure calls. The proxy resides in the same process as the client, so from the client's perspective, all interface calls look alike. The proxy intercepts the client's call and forwards it to where the real object is running. The mechanism that enables the client to access objects in a different process space, or even different machine, as if they were in their own process, is called marshaling.

Out-of-process and remote servers

The difference between out-of-process and remote servers is the type of interprocess communication used. The proxy uses COM to communicate with an out-of-process server, it uses distributed COM (DCOM) to communicate with a remote machine. DCOM transparently transfers a local object request to the remote object running on a different machine.

Note: For remote procedure calls, DCOM uses the RPC protocol provided by Open Group's Distributed Computing Environment (DCE). For distributed security, DCOM uses the NT LAN Manager (NTLM) security protocol. For directory services, DCOM uses the Domain Name System (DNS).

See Also