48.1.5 Waiting for Services

This section only applies to the Modern C++ and Python APIs.

The Requester provides two operations that can be used to wait for services:

1. wait_for_service (const dds::core::Duration &maxWait)

2. wait_for_service ()

The first operation blocks until a service is available or until maxWait time has passed, whichever comes first. The second one blocks until a service is available, for an unlimited period of time.

Calling wait_for_service() is required to ensure that the discovery process has finished. If the Requester sends a request without waiting, the result will be an exception if the discovery process has not been finalized.