Server Routines

The RPC run-time routines that are called by servers initialize the server, except for one routine that identifies the object to which a client has requested access.

Most of the server routines in the RPC run-time library initialize the server so that it can respond to client requests for one or more interfaces. In the server code, routines should be included to do the following:

  • Create one or more sockets to which clients can send messages.
  • Register each interface that the server exports.
  • Begin listening for client requests.

The RPC run-time library provides two routines that create sockets. One creates a socket with a well-known port while the other creates a socket with an opaque port number.

A single server can support several interfaces. It can also listen on several sockets at a time. Most servers use one socket for each address family. A server is not required to use different sockets for different interfaces.

The server must register each interface that it exports with the RPC run-time library so that the run-time library can direct client calls to the procedures that implement the requested operations. The library also includes a routine to unregister an interface that the server no longer exports.

When the server creates sockets, registers its interfaces, and begins listening, it is not required to make additional calls to the initialization routines. However, a server can register and unregister interfaces while it is running.