To inquire for the addresses of remote devices, take the following steps:

Connect to the Sockets Server (RSocketServ), and then select the protocol to be used using RSocketServ::FindProtocol(). Address and name queries are supplied by the stack's BTLinkManager protocol layer, so select this.

Create and initialise an RHostResolver object.

Set the TInquirySockAddr parameter for the inquiry: for address inquiries, the KHostResInquiry flag must be set through TInquirySockAddr::SetAction().

The query can then be started with RHostResolver::GetByAddress().

When GetByAddress() completes, it fills in a TNameEntry object with the address and class of the first device found (or is undefined if no device was found).

To get all the devices discovered, call RHostResolver::Next() repeatedly until KErrHostResNoMoreResults is returned.