CFNetwork Error Codes Reference
| Framework | CoreServices |
| Companion guide | |
| Declared in | CFNetworkErrors.h |
Overview
Many functions in the CFNetwork API return error codes to indicate the cause of a failure. This document explains these error codes.
Constants
CFNetworkErrors Constants
This enumeration contains error codes returned under the error domain kCFErrorDomainCFNetwork.
enum CFNetworkErrors {
kCFHostErrorHostNotFound = 1,
kCFHostErrorUnknown = 2,
/* SOCKS errors */
kCFSOCKSErrorUnknownClientVersion = 100,
kCFSOCKSErrorUnsupportedServerVersion = 101,
/* SOCKS4-specific errors*/
kCFSOCKS4ErrorRequestFailed = 110,
kCFSOCKS4ErrorIdentdFailed = 111,
kCFSOCKS4ErrorIdConflict = 112,
kCFSOCKS4ErrorUnknownStatusCode = 113,
/* SOCKS5-specific errors*/
kCFSOCKS5ErrorBadState = 120,
kCFSOCKS5ErrorBadResponseAddr = 121,
kCFSOCKS5ErrorBadCredentials = 122,
kCFSOCKS5ErrorUnsupportedNegotiationMethod = 123,
kCFSOCKS5ErrorNoAcceptableMethod = 124,
/* FTP errors */
kCFFTPErrorUnexpectedStatusCode = 200,
/* HTTP errors*/
kCFErrorHTTPAuthenticationTypeUnsupported = 300,
kCFErrorHTTPBadCredentials = 301,
kCFErrorHTTPConnectionLost = 302,
kCFErrorHTTPParseFailure = 303,
kCFErrorHTTPRedirectionLoopDetected = 304,
kCFErrorHTTPBadURL = 305,
kCFErrorHTTPProxyConnectionFailure = 306,
kCFErrorHTTPBadProxyCredentials = 307,
kCFErrorPACFileError = 308,
kCFErrorPACFileAuth = 309,
kCFErrorHTTPSProxyConnectionFailure = 310,
kCFStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethod = 311,
/* CFURL and CFURLConnection Errors */
kCFURLErrorUnknown = -998,
kCFURLErrorCancelled = -999,
kCFURLErrorBadURL = -1000,
kCFURLErrorTimedOut = -1001,
kCFURLErrorUnsupportedURL = -1002,
kCFURLErrorCannotFindHost = -1003,
kCFURLErrorCannotConnectToHost = -1004,
kCFURLErrorNetworkConnectionLost = -1005,
kCFURLErrorDNSLookupFailed = -1006,
kCFURLErrorHTTPTooManyRedirects = -1007,
kCFURLErrorResourceUnavailable = -1008,
kCFURLErrorNotConnectedToInternet = -1009,
kCFURLErrorRedirectToNonExistentLocation = -1010,
kCFURLErrorBadServerResponse = -1011,
kCFURLErrorUserCancelledAuthentication = -1012,
kCFURLErrorUserAuthenticationRequired = -1013,
kCFURLErrorZeroByteResource = -1014,
kCFURLErrorCannotDecodeRawData = -1015,
kCFURLErrorCannotDecodeContentData = -1016,
kCFURLErrorCannotParseResponse = -1017,
kCFURLErrorInternationalRoamingOff = -1018,
kCFURLErrorCallIsActive = -1019,
kCFURLErrorDataNotAllowed = -1020,
kCFURLErrorRequestBodyStreamExhausted = -1021,
kCFURLErrorFileDoesNotExist = -1100,
kCFURLErrorFileIsDirectory = -1101,
kCFURLErrorNoPermissionsToReadFile = -1102,
kCFURLErrorDataLengthExceedsMaximum = -1103,
/* SSL errors */
kCFURLErrorSecureConnectionFailed = -1200,
kCFURLErrorServerCertificateHasBadDate = -1201,
kCFURLErrorServerCertificateUntrusted = -1202,
kCFURLErrorServerCertificateHasUnknownRoot = -1203,
kCFURLErrorServerCertificateNotYetValid = -1204,
kCFURLErrorClientCertificateRejected = -1205,
kCFURLErrorClientCertificateRequired = -1206,
kCFURLErrorCannotLoadFromNetwork = -2000,
/* Download and file I/O errors */
kCFURLErrorCannotCreateFile = -3000,
kCFURLErrorCannotOpenFile = -3001,
kCFURLErrorCannotCloseFile = -3002,
kCFURLErrorCannotWriteToFile = -3003,
kCFURLErrorCannotRemoveFile = -3004,
kCFURLErrorCannotMoveFile = -3005,
kCFURLErrorDownloadDecodingFailedMidStream = -3006,
kCFURLErrorDownloadDecodingFailedToComplete = -3007,
/* Cookie errors */
kCFHTTPCookieCannotParseCookieFile = -4000,
/* Errors originating from CFNetServices*/
kCFNetServiceErrorUnknown = -72000L,
kCFNetServiceErrorCollision = -72001L,
kCFNetServiceErrorNotFound = -72002L,
kCFNetServiceErrorInProgress = -72003L,
kCFNetServiceErrorBadArgument = -72004L,
kCFNetServiceErrorCancel = -72005L,
kCFNetServiceErrorInvalid = -72006L,
kCFNetServiceErrorTimeout = -72007L,
kCFNetServiceErrorDNSServiceFailure = -73000L,
};
typedef enum CFNetworkErrors CFNetworkErrors;
Constants
kCFHostErrorHostNotFoundIndicates that the DNS lookup failed.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFHostErrorUnknownAn unknown error occurred (a name server failure, for example). For additional information, you can query the
kCFGetAddrInfoFailureKeykey to obtain the value returned bygetaddrinfoand look up the value in/usr/include/netdb.h.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKSErrorUnknownClientVersionThe SOCKS server rejected access because it does not support connections with the requested SOCKS version. SOCKS client version. You can query the
kCFSOCKSVersionKeykey to find out what version the server requested.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKSErrorUnsupportedServerVersionThe version of SOCKS requested by the server is not supported. You can query the
kCFSOCKSVersionKeykey to find out what version the server requested.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS4ErrorRequestFailedRequest rejected by the server or request failed. This error is specific to SOCKS4.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS4ErrorIdentdFailedRequest rejected by the server because it could not connect to the
identddaemon on the client. This error is specific to SOCKS4.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS4ErrorIdConflictRequest rejected by the server because the client program and the
identddaemon reported different user IDs. This error is specific to SOCKS4.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS4ErrorUnknownStatusCodeThe status code returned by the server is unknown. This error is specific to SOCKS4.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS5ErrorBadStateThe stream is not in a state that allows the requested operation.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS5ErrorBadResponseAddrThe address type returned is not supported
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS5ErrorBadCredentialsThe SOCKS server refused the client connection because of bad login credentials.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS5ErrorUnsupportedNegotiationMethodThe requested method is not supported. You can query the
kCFSOCKSNegotiationMethodKeykey to find out which method the server requested.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKS5ErrorNoAcceptableMethodThe client and server could not find a mutually agreeable authentication method.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFFTPErrorUnexpectedStatusCodeThe server returned an unexpected status code.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPAuthenticationTypeUnsupportedThe client and server could not agree on a supported authentication type.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPBadCredentialsThe credentials provided for an authenticated connection were rejected by the server.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPConnectionLostThe connection to the server was dropped. This usually indicates a highly overloaded server.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPParseFailureThe HTTP server response could not be parsed.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPRedirectionLoopDetectedToo many HTTP redirects occurred before reaching a page that did not redirect the client to another page. This usually indicates a redirect loop.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPBadURLThe requested URL could not be retrieved.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPProxyConnectionFailureA connection could not be established to the HTTP proxy.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPBadProxyCredentialsThe authentication credentials provided for logging into the proxy were rejected.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorPACFileErrorAn error occurred with the proxy autoconfiguration file.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFErrorPACFileAuthThe authentication credentials provided by the proxy autoconfiguration file were rejected.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFErrorHTTPSProxyConnectionFailureA connection could not be established to the HTTPS proxy.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethodThe HTTPS proxy returned an unexpected status code, such as a
3xxredirect.Available in OS X v10.7 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorUnknownAn unknown error occurred.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCancelledThe connection was cancelled.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorBadURLThe connection failed due to a malformed URL.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorTimedOutThe connection timed out.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorUnsupportedURLThe connection failed due to an unsupported URL scheme.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotFindHostThe connection failed because the host could not be found.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotConnectToHostThe connection failed because a connection cannot be made to the host.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorNetworkConnectionLostThe connection failed because the network connection was lost.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorDNSLookupFailedThe connection failed because the DNS lookup failed.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorHTTPTooManyRedirectsThe HTTP connection failed due to too many redirects.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorResourceUnavailableThe connection’s resource is unavailable.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorNotConnectedToInternetThe connection failed because the device is not connected to the internet.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorRedirectToNonExistentLocationThe connection was redirected to a nonexistent location.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorBadServerResponseThe connection received an invalid server response.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorUserCancelledAuthenticationThe connection failed because the user cancelled required authentication.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorUserAuthenticationRequiredThe connection failed because authentication is required.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorZeroByteResourceThe resource retrieved by the connection is zero bytes.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotDecodeRawDataThe connection cannot decode data encoded with a known content encoding.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotDecodeContentDataThe connection cannot decode data encoded with an unknown content encoding.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotParseResponseThe connection cannot parse the server’s response.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorInternationalRoamingOffThe connection failed because international roaming is disabled on the device.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCallIsActiveThe connection failed because a call is active.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorDataNotAllowedThe connection failed because data use is currently not allowed on the device.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorRequestBodyStreamExhaustedThe connection failed because its request’s body stream was exhausted.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorFileDoesNotExistThe file operation failed because the file does not exist.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorFileIsDirectoryThe file operation failed because the file is a directory.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorNoPermissionsToReadFileThe file operation failed because it does not have permission to read the file.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorDataLengthExceedsMaximumThe file operation failed because the file is too large.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorSecureConnectionFailedThe secure connection failed for an unknown reason.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorServerCertificateHasBadDateThe secure connection failed because the server’s certificate has an invalid date.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorServerCertificateUntrustedThe secure connection failed because the server’s certificate is not trusted.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorServerCertificateHasUnknownRootThe secure connection failed because the server’s certificate has an unknown root.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorServerCertificateNotYetValidThe secure connection failed because the server’s certificate is not yet valid.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorClientCertificateRejectedThe secure connection failed because the client’s certificate was rejected.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorClientCertificateRequiredThe secure connection failed because the server requires a client certificate.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotLoadFromNetworkThe connection failed because it is being required to return a cached resource, but one is not available.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotCreateFileThe file cannot be created.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotOpenFileThe file cannot be opened.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotCloseFileThe file cannot be closed.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotWriteToFileThe file cannot be written.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotRemoveFileThe file cannot be removed.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorCannotMoveFileThe file cannot be moved.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorDownloadDecodingFailedMidStreamThe download failed because decoding of the downloaded data failed mid-stream.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFURLErrorDownloadDecodingFailedToCompleteThe download failed because decoding of the downloaded data failed to complete.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFHTTPCookieCannotParseCookieFileThe cookie file cannot be parsed.
Available in OS X v10.6 and later.
Declared in
CFNetworkErrors.h.kCFNetServiceErrorUnknownAn unknown error occurred.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorCollisionAn attempt was made to use a name that is already in use.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorNotFoundNot used.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorInProgressA new search could not be started because a search is already in progress.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorBadArgumentA required argument was not provided or was not valid.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorCancelThe search or service was cancelled.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorInvalidInvalid data was passed to a CFNetServices function.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorTimeoutA search failed because it timed out.
Declared in
CFNetworkErrors.h.Available in OS X v10.2 and later.
kCFNetServiceErrorDNSServiceFailureDNS service discovery returned an error. You can query the
kCFDNSServiceFailureKeykey to find out the error returned by DNS service discovery and look up the code in/usr/include/dns_sd.hor DNS Service Discovery C Reference.Declared in
CFNetworkErrors.h.Available in OS X v10.5 and later.
Discussion
To determine the source of an error, examine the userInfo dictionary included in the CFError object returned by a function call or call CFErrorGetDomain and pass in the CFError object and the domain whose value you want to read. These errors are all part of the kCFErrorDomainCFNetwork domain.
Availability
- Available in OS X version 10.5 and later.
Declared In
CFNetwork/CFHost.hProperty Keys
Keys for calls to property get/set functions such as CFReadStreamSetProperty and CFReadStreamCopyProperty.
extern const CFStringRef kCFGetAddrInfoFailureKey; extern const CFStringRef kCFSOCKSStatusCodeKey; extern const CFStringRef kCFSOCKSVersionKey; extern const CFStringRef kCFSOCKSNegotiationMethodKey; extern const CFStringRef kCFDNSServiceFailureKey; extern const CFStringRef kCFFTPStatusCodeKey;
Constants
kCFGetAddrInfoFailureKeyQuerying this key returns the last error code returned by
getaddrinfoin response to a DNS lookup. To interpret the results, look up the error code in/usr/include/netdb.h.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKSStatusCodeKeyQuerying this key returns the last status code sent by the SOCKS server in response to the previous operation.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKSVersionKeyQuerying this key returns the SOCKS version in use by the current connection.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFSOCKSNegotiationMethodKeyQuerying this key returns the negotiation method requested by the SOCKS server.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFDNSServiceFailureKeyQuerying this key returns the last error returned by the DNS resolver libraries in response to the previous operation. To interpret the results, look up the error codes in
/usr/include/dns_sd.hor DNS Service Discovery C Reference.Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.kCFFTPStatusCodeKeyQuerying this key returns the last status code sent by the FTP server in response to the previous operation.
Available in OS X v10.5 and later.
Declared in
CFNetworkErrors.h.
Error Domains
High-level error domains.
extern const CFStringRef kCFErrorDomainCFNetwork; extern const CFStringRef kCFErrorDomainWinSock;
Constants
kCFErrorDomainCFNetworkError domain that returns error codes specific to the CFNetwork stack.
Declared in
CFNetworkErrors.h.Available in OS X version 10.5 and later.
kCFErrorDomainWinSockError domain that returns error codes specific to the underlying network layer when running CFNetwork code on Windows.
Declared in
CFNetworkErrors.h.Available in OS X version 10.5 and later.
Discussion
To determine the source of an error, examine the userInfo dictionary included in the CFError object returned by a function call or call CFErrorGetDomain and pass in the CFError object and the domain whose value you want to read.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)