---
title: "CFHostSetClient(_:_:_:)"
framework: cfnetwork
role: symbol
role_heading: Function
path: "cfnetwork/cfhostsetclient(_:_:_:)"
---

# CFHostSetClient(_:_:_:)

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

## Declaration

```swift
func CFHostSetClient(_ theHost: CFHost, _ clientCB: CFHostClientCallBack?, _ clientContext: UnsafeMutablePointer<CFHostClientContext>?) -> Bool
```

## Parameters

- `theHost`: The host to modify. The value must not be NULL.
- `clientCB`: The callback function to associate with theHost. The callback function will be called when a resolution completes or is cancelled. If you are calling this function to disassociate a client context and callback from theHost, pclientCBass NULL.
- `clientContext`: A doc://com.apple.cfnetwork/documentation/CFNetwork/CFHostClientContext structure whose info field will be passed to the callback function specified by clientCB when clientCB is called. This value must not be NULL when setting an association. Pass NULL when disassociating a client context and a callback from a host.

## Return Value

Return Value TRUE if the association could be set or unset, otherwise FALSE.

## Discussion

Discussion The callback function specified by clientCB will be called when a resolution completes or is cancelled. Special Considerations This function is thread safe.

## See Also

### Hosts

- [CFHost](cfnetwork/cfhost.md)
- [CFHostInfoType](cfnetwork/cfhostinfotype.md)
- [CFHostClientContext](cfnetwork/cfhostclientcontext.md)
- [CFHostCancelInfoResolution(_:_:)](cfnetwork/cfhostcancelinforesolution(_:_:).md)
- [CFHostCreateCopy(_:_:)](cfnetwork/cfhostcreatecopy(_:_:).md)
- [CFHostCreateWithAddress(_:_:)](cfnetwork/cfhostcreatewithaddress(_:_:).md)
- [CFHostCreateWithName(_:_:)](cfnetwork/cfhostcreatewithname(_:_:).md)
- [CFHostGetAddressing(_:_:)](cfnetwork/cfhostgetaddressing(_:_:).md)
- [CFHostGetNames(_:_:)](cfnetwork/cfhostgetnames(_:_:).md)
- [CFHostGetReachability(_:_:)](cfnetwork/cfhostgetreachability(_:_:).md)
- [CFHostGetTypeID()](cfnetwork/cfhostgettypeid().md)
- [CFHostScheduleWithRunLoop(_:_:_:)](cfnetwork/cfhostschedulewithrunloop(_:_:_:).md)
- [CFHostStartInfoResolution(_:_:_:)](cfnetwork/cfhoststartinforesolution(_:_:_:).md)
- [CFHostUnscheduleFromRunLoop(_:_:_:)](cfnetwork/cfhostunschedulefromrunloop(_:_:_:).md)
