The COM server is the program that implements COM interfaces and classes. COM Servers come in three basic configurations.
l In-process, or DLL servers
l Stand-alone EXE servers
l Windows NT based services.
COM objects are the same regardless of the type of server. The COM interfaces and coclasses(***) don't care what type of server is being
used. To the client program, the type of server is almost entirely transparent. Writing the actual server however, can be significantly different
for each configuration:
l In-Process servers are implemented as Dynamic Link Libraries (DLL's). This means that the server is dynamically loaded into your
process at run-time. The COM server becomes part of your application, and COM operations are performed within application threads.
Traditionally this is how many COM objects have been implemented because performance is fantastic - there is minimal overhead for a
COM function call but you get all of the design and reuse advantages of COM. COM automatically handles the loading and unloading of
the DLL.
l An out-of-process server has a more clear-cut distinction between the client and server. This type of server runs as a separate
executable (EXE) program, and therefore in a private process space. The starting and stopping of the EXE server is handled by the
Windows Service Control Manager (SCM). Calls to COM interfaces are handled through inter-process communication mechanisms. The
server can be running on the local computer, or on a remote computer. If the server is on a remote computer, we refer to this as
"Distributed COM", or DCOM.
l Windows NT offers the concept of a service. A service is a program that is automatically managed by Windows NT, and is not
associated with the desktop user. This means services can start automatically at boot time and can run even if nobody is logged on to
Windows NT. Services offer an excellent way to run COM server applications.
l There is a fourth type of server, called a "surrogate". This is essentially a program that allows an in-process server to run remotely.
Surrogates are useful when making a DLL-based COM server available over the network.
0 comments:
Post a Comment