| Lesson 4 || COM clients and servers |
| Objective || Describe how COM is used to develop client-server applications. |
COM Clients and Servers
In COM, clients deal with objects, interfaces, and methods.
They do not directly communicate with a server, nor do they (usually) need to know the location of the server.
After a COM object is created, the client works with the object through its interfaces.
The actual location of the server is transparent to the client.
This abstraction, or hiding, of the location of the server is called local/remote transparency.
Having obtained a pointer to a COM interface, a client simply makes calls into the interface.
To the client, there is no difference between calling a method in a server on the
same machine or calling a machine across the network!
The COM runtime subsystem handles the details involved with making the connection to the server and calls to servers in different processes.
COM provides an elegant and compact solution to client-server development by providing a uniform access mechanism between clients and objects. Other client-server development technologies have the client communicate with the server via a specific mechanism,
for example, sockets and RPC. This places a heavy burden on clients.
They must have specific knowledge of where a server is, how to format data, and how to call into the server over the specific technology in use.
A socket client must format data into a stream and send it to the server by making socket calls.
In COM, a client simply asks the COM runtime subsystem for a pointer to a COM interface contained in a COM object and makes
calls. COM handles all the underlying details.