### Dynamic Endpoints

A dynamic endpoint is requested and assigned at runtime. For some transport protocols, the number of endpoints is limited; for example, TCP/IP and UDP/IP use a 16-bit number for endpoints, which allows 65,535 endpoints. When the supply of endpoints for a transport protocol is limited, the protocol ensures an adequate supply of endpoints by limiting the portion that can be reserved as well-known endpoints. A transport, on request, dynamically makes its remaining endpoints available on a first-come, first-served basis to specific processes such as RPC server instances.

When a server requests dynamic endpoints, the server's RPC runtime asks the operating system for a unique dynamic endpoint for each protocol sequence the server is using. For a given protocol sequence, the local implementation of the corresponding transport protocol provides the requested endpoints. When an RPC server with dynamic endpoints stops listening, its dynamic endpoints are released.

Because of the transient nature of dynamic endpoints, the NSI of the RPC API does not export them to a namespace; however, NSI does export the rest of the server's binding information. References to expired endpoints would remain indefinitely in server entries, causing clients to import and try, unsuccessfully, to establish bindings to nonexistent endpoints. Therefore, the export operation removes dynamic endpoints before adding binding information to a server entry; the exported server address contains only network addressing information. The import operation returns a partially bound binding handle. The client makes its first remote procedure call with the partially bound handle, and the endpoint mapper service on the server's system resolves the binding handle with the endpoint of a compatible server. To make dynamic endpoints available to clients that are using partially bound binding handles, a server must register its dynamic endpoints in the local endpoint map.

By using object UUIDs, a server can ensure that a client that imports a partially bound handle obtains one of a particular server's endpoints. This requires that the server do the following:

1. Specify a list of one or more object UUIDs that are unique to the server.

2. Export the list of object UUIDs.

3. Supply the list of object UUIDs to the endpoint map service when registering endpoints.

4. If the server provides different managers that implement an interface for different types of objects, the server must specify the type of each object.

To request binding information for a particular server, a client specifies one of the server's object UUIDs, which is then associated with the server binding information the client uses for making a remote procedure call.

Note: If a client requests the nil object UUID when importing from a server entry containing object UUIDs, the client runtime selects one of those object UUIDs and associates it with the imported server binding information. This object UUID guarantees that the call goes to the server that exported the binding information and object UUID to the server entry.

##