The CFHost API allows you to create instances of the CFHost object that you can use to acquire host information, including names, addresses, and reachability information.
The process of acquiring information about a host is known as resolution. Begin by calling
CFHostCreateWithName to create an instance of a CFHost using an address or a name, respectively. If you want to resolve the host asynchronously. call
CFHostSetClient to associate your client context and user-defined callback function with the host. Then call
CFHostScheduleWithRunLoop to schedule the host on a run loop.
To start resolution, call
CFHostStartInfoResolution. If you set up for asynchronous resolution,
CFHostStartInfoResolution returns immediately. Your callback function will be called when resolution is complete. If you didn’t set up for asynchronous resolution,
CFHostStartInfoResolution blocks until resolution is complete, an error occurs, or the resolution is cancelled.
When resolution is complete, call
CFHostGetNames to get an array of known addresses or known names, respectively, for the host. Call
CFHostGetReachability to get flags, declared in
SystemConfiguration/SCNetwork.h, that describe the reachability of the host.
When you no longer need a CFHost object, call
CFHostSetClient to disassociate the host from your user-defined client context and callback function (if it was set up for asynchronous resolution). Then dispose of it.