---
title: "CFHostCreateWithName(_:_:)"
framework: cfnetwork
role: symbol
role_heading: Function
path: "cfnetwork/cfhostcreatewithname(_:_:)"
---

# CFHostCreateWithName(_:_:)

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

## Declaration

```swift
func CFHostCreateWithName(_ allocator: CFAllocator?, _ hostname: CFString) -> Unmanaged<CFHost>
```

## Parameters

- `hostname`: A string representing the name of the host. This value must not be NULL.

## Return Value

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

Discussion Call CFHostStartInfoResolution(_:_:_:) to resolve the object’s addresses and reachability information. 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)
- [CFHostGetAddressing(_:_:)](cfnetwork/cfhostgetaddressing(_:_:).md)
- [CFHostGetNames(_:_:)](cfnetwork/cfhostgetnames(_:_:).md)
- [CFHostGetReachability(_:_:)](cfnetwork/cfhostgetreachability(_:_:).md)
- [CFHostGetTypeID()](cfnetwork/cfhostgettypeid().md)
- [CFHostScheduleWithRunLoop(_:_:_:)](cfnetwork/cfhostschedulewithrunloop(_:_:_:).md)
- [CFHostSetClient(_:_:_:)](cfnetwork/cfhostsetclient(_:_:_:).md)
- [CFHostStartInfoResolution(_:_:_:)](cfnetwork/cfhoststartinforesolution(_:_:_:).md)
- [CFHostUnscheduleFromRunLoop(_:_:_:)](cfnetwork/cfhostunschedulefromrunloop(_:_:_:).md)
