---
title: cannotConnectToHost
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/urlerror/cannotconnecttohost
---

# cannotConnectToHost

An attempt to connect to a host failed.

## Declaration

```swift
static var cannotConnectToHost: URLError.Code { get }
```

## Discussion

Discussion This can occur when a host name resolves, but the host is down or may not be accepting connections on a certain port.

## See Also

### Error codes

- [appTransportSecurityRequiresSecureConnection](foundation/urlerror/apptransportsecurityrequiressecureconnection.md)
- [backgroundSessionInUseByAnotherProcess](foundation/urlerror/backgroundsessioninusebyanotherprocess.md)
- [backgroundSessionRequiresSharedContainer](foundation/urlerror/backgroundsessionrequiressharedcontainer.md)
- [backgroundSessionWasDisconnected](foundation/urlerror/backgroundsessionwasdisconnected.md)
- [badServerResponse](foundation/urlerror/badserverresponse.md)
- [badURL](foundation/urlerror/badurl.md)
- [callIsActive](foundation/urlerror/callisactive.md)
- [cancelled](foundation/urlerror/cancelled.md)
- [cannotCloseFile](foundation/urlerror/cannotclosefile.md)
- [cannotCreateFile](foundation/urlerror/cannotcreatefile.md)
- [cannotDecodeContentData](foundation/urlerror/cannotdecodecontentdata.md)
- [cannotDecodeRawData](foundation/urlerror/cannotdecoderawdata.md)
- [cannotFindHost](foundation/urlerror/cannotfindhost.md)
- [cannotLoadFromNetwork](foundation/urlerror/cannotloadfromnetwork.md)
- [cannotMoveFile](foundation/urlerror/cannotmovefile.md)
