How Do Client/Server Objects Work?

A client application, such as a compound document container, makes a call to methods in a COM interface. An object application (sometimes called the server) implements an object that provides the interface and methods that are called by the client. A reference to the object application is stored in the registry. OLE locates the object application through this reference and runs it.

The object application is a piece of code that implements one or more COM interfaces. It can be an in-process server in a DLL or a local executable that runs in another process. Making a call to an interface method in an object in another process involves the cooperation of several components. The standard proxy is a piece of interface-specific code that resides in the client's process space and prepares the interface parameters for transmittal. It packages, or marshals, them in such a way that they can be re-created and understood in the receiving process. The standard stub, also a piece of interface-specific code, resides in the server's process space and reverses the work of the proxy. The stub unpackages, or unmarshals, the sent parameters and forwards them to the object application. It also packages reply information to send back to the client.

Note Readers more familiar with RPC than OLE may be used to seeing the terms client stub and server stub. These terms are analogous to proxy and stub.

The following diagram shows the flow of communication between the components involved. On the client side of the process boundary, the client's method call goes through the proxy and then onto the channel. Note that the channel is part of the COM library. The channel sends the buffer containing the marshalled parameters to the RPC run-time library, which transmits it across the process boundary. The RPC run-time and the COM libraries exist on both sides of the process. Note also that the distinction between the channel and the RPC run-time is a characteristic of this implementation and is not part of the programming model or the conceptual model for OLE client/server objects. OLE object applications see only the proxy or stub and, indirectly, the channel. Future implementations may use different layers below the channel or no layers.

The following sections discuss some of the issues involved in Custom Interface technology and describe these components in greater detail.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples