Function

CFNetServiceResolveWithTimeout

Gets the IP address or addresses for a CFNetService.

Declaration

Boolean CFNetServiceResolveWithTimeout(CFNetServiceRef theService, CFTimeInterval timeout, CFStreamError *error);

Parameters

theService

The CFNetService to resolve; cannot be NULL. The resolution will fail if the service doesn’t have a domain, a type, and a name.

timeout

Value of type CFTimeInterval specifying the maximum amount of time allowed to perform the resolution. If the resolution is not performed within the specified amount of time, a timeout error will be returned. If timeout is less than or equal to zero, an infinite amount of time is allowed.

error

Pointer to a CFStreamError structure that will be set to an error code and the error code’s domain if an error occurs; or NULL if you don’t want to receive the error code and its domain.

Return Value

TRUE if an asynchronous service resolution was started or if a synchronous service resolution updated the CFNetService; FALSE if an asynchronous or synchronous resolution failed or timed out, or if a synchronous resolution was canceled.

Discussion

This function updates the specified CFNetService with the IP address or addresses associated with the service. Call CFNetServiceGetAddressing to get the addresses.

When resolving a service that runs in asynchronous mode, this function returns TRUE if the CFNetService has a domain, type, and name, and the underlying resolution process was started. Otherwise, this function returns FALSE. Once started, the resolution continues until it is canceled by calling CFNetServiceCancel.

When resolving a service that runs in synchronous mode, this function blocks until the CFNetService is updated with at least one IP address, until an error occurs, or until CFNetServiceCancel is called.

Special Considerations

This function is thread safe.

If the service will be used in asynchronous mode, you must call CFNetServiceSetClient before calling this function.

See Also

Network Services

CFNetServiceRef

An opaque reference representing a CFNetService.

CFNetServiceBrowserRef

An opaque reference representing a CFNetServiceBrowser.

CFNetServiceMonitorRef

An opaque reference for a service monitor.

CFNetServiceMonitorType

Record type specifier used to tell a service monitor the type of record changes to watch for.

CFNetServiceClientContext

A structure provided when a CFNetService is associated with a callback function or when a CFNetServiceBrowser is created.

CFNetServicesError

Error codes that may be returned by CFNetServices functions or passed to CFNetServices callback functions.

CFNetServiceBrowserInvalidate

Invalidates an instance of a Network Service browser object.

CFNetServiceBrowserScheduleWithRunLoop

Schedules a CFNetServiceBrowser on a run loop.

CFNetServiceBrowserCreate

Creates an instance of a Network Service browser object.

CFNetServiceBrowserGetTypeID

Gets the Core Foundation type identifier for the Network Service browser object.

CFNetServiceBrowserSearchForServices

Searches a domain for services of a specified type.

CFNetServiceBrowserStopSearch

Stops a search for domains or services.

CFNetServiceBrowserUnscheduleFromRunLoop

Unschedules a CFNetServiceBrowser from a run loop and mode.

CFNetServiceCancel

Cancels a service registration or a service resolution.

CFNetServiceCreate

Creates an instance of a Network Service object.

CFNetServiceCreateCopy

Creates a copy of a CFNetService object.

CFNetServiceCreateDictionaryWithTXTData

Uses TXT record data to create a dictionary.

CFNetServiceCreateTXTDataWithDictionary

Flattens a set of key/value pairs into a CFDataRef suitable for passing to CFNetServiceSetTXTData.

CFNetServiceGetAddressing

Gets the IP addressing from a CFNetService.

CFNetServiceGetDomain

Gets the domain from a CFNetService.

CFNetServiceGetName

Gets the name from a CFNetService.

CFNetServiceGetPortNumber

This function gets the port number from a CFNetService.

CFNetServiceGetTXTData

Queries a network service for the contents of its TXT records.

CFNetServiceGetTargetHost

Queries a CFNetService for its target hosts.

CFNetServiceGetType

Gets the type from a CFNetService.

CFNetServiceGetTypeID

Gets the Core Foundation type identifier for the Network Service object.

CFNetServiceMonitorCreate

Creates an instance of a NetServiceMonitor object that watches for record changes.

CFNetServiceMonitorGetTypeID

Gets the Core Foundation type identifier for all CFNetServiceMonitor instances.

CFNetServiceMonitorInvalidate

Invalidates an instance of a Network Service monitor object.

CFNetServiceMonitorScheduleWithRunLoop

Schedules a CFNetServiceMonitor on a run loop.

CFNetServiceMonitorStart

Starts monitoring.

CFNetServiceMonitorStop

Stops a CFNetServiceMonitor.

CFNetServiceMonitorUnscheduleFromRunLoop

Unschedules a CFNetServiceMonitor from a run loop.

CFNetServiceRegister

Makes a CFNetService available on the network.

Deprecated
CFNetServiceRegisterWithOptions

Makes a CFNetService available on the network.

CFNetServiceResolve

This function updates the specified CFNetService with the IP address or addresses associated with the service. Call CFNetServiceGetAddressing to get the addresses.

Deprecated
CFNetServiceSetClient

Associates a callback function with a CFNetService or disassociates a callback function from a CFNetService.

CFNetServiceSetTXTData

Sets the TXT record for a CFNetService.

CFNetServiceUnscheduleFromRunLoop

Unschedules a CFNetService from a run loop.

CFNetServiceScheduleWithRunLoop

Schedules a CFNetService on a run loop.