Function

CFHostCreateWithAddress(_:_:)

Uses an address to create an instance of a host object.

Declaration

func CFHostCreateWithAddress(_ allocator: CFAllocator?, _ addr: CFData) -> Unmanaged<CFHost>

Parameters

alloc

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

addr

A CFDataRef object containing a sockaddr structure for the address of the host. This value must not be NULL.

Return Value

A valid CFHostRef object that can be resolved, or NULL if the host could not be created. Ownership follows the The Create Rule.

Discussion

Call CFHostStartInfoResolution(_:_:_:) to resolve the return object’s name and reachability information.

Special Considerations

This function is thread safe.

See Also

Hosts

class CFHost

An opaque reference representing an CFHost object.

enum CFHostInfoType

Values indicating the type of data that is to be resolved or the type of data that was resolved.

struct CFHostClientContext

A structure containing user-defined data and callbacks for CFHost objects.

func CFHostCreateWithName(CFAllocator?, CFString) -> Unmanaged<CFHost>

Uses a name to create an instance of a host object.

func CFHostGetTypeID() -> CFTypeID

Gets the Core Foundation type identifier for the CFHost opaque type.

func CFHostSetClient(CFHost, CFHostClientCallBack?, UnsafeMutablePointer<CFHostClientContext>?) -> Bool

Associates a client context and a callback function with a CFHost object or disassociates a client context and callback function that were previously set.