<!--
{
  "documentType" : "article",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/1518266-secure-sockets-socks-errors",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Secure Sockets (SOCKS) Errors"
}
-->

# Secure Sockets (SOCKS) Errors

Error codes returned by the `kCFStreamErrorDomainSOCKS` error domain.

## Discussion

Error codes in the `kCFStreamErrorDomainSOCKS` domain can come from multiple parts of the protocol stack, many of which define their own error values as part of outside specifications such as the HTTP specification.

To avoid confusion from conflicting error numbers, error codes in the `kCFStreamErrorDomainSOCKS` domain contain two parts: a subdomain, which tells which part of the protocol stack generated the error, and the error code itself.

Calling [`CFSocketStreamSOCKSGetErrorSubdomain(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetErrorSubdomain(_:)) returns an identifier that tells which layer of the protocol stack produced the error.

Calling [`CFSocketStreamSOCKSGetError(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetError(_:)) returns the actual error code that the subdomain describes. This list of constants contains the possible values that this function will return. They must be interpreted within the context of the relevant error subdomain.

## Topics

### Constants

[`var kCFStreamErrorSOCKS4IdConflict: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS4IdConflict)

Request rejected by the server because the client program and the `identd` daemon reported different user IDs.

[`var kCFStreamErrorSOCKS4IdentdFailed: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS4IdentdFailed)

Request rejected by the server because it couldn’t connect to the `identd` daemon on the client.

[`var kCFStreamErrorSOCKS4RequestFailed: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS4RequestFailed)

Request rejected by the server or request failed.

[`var kCFStreamErrorSOCKS4SubDomainResponse: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS4SubDomainResponse)

The SOCKS4 status code returned by the server.

[`var kCFStreamErrorSOCKS5SubDomainMethod: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS5SubDomainMethod)

The server’s desired negotiation method.

[`var kCFStreamErrorSOCKS5SubDomainResponse: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS5SubDomainResponse)

The response code that the server returned in reply to the connection request.

[`var kCFStreamErrorSOCKS5SubDomainUserPass: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS5SubDomainUserPass)

The status code that the server returned during authentication.

[`var kCFStreamErrorSOCKSSubDomainNone: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKSSubDomainNone)

A general SOCKS error.

[`var kCFStreamErrorSOCKSSubDomainVersionCode: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKSSubDomainVersionCode)

The version of SOCKS that the server wants to use.

[`var kSOCKS5NoAcceptableMethod: Int`](/documentation/CFNetwork/kSOCKS5NoAcceptableMethod)

The client and server couldn’t find a mutually agreeable authentication method.

[`var kCFStreamErrorSOCKS5BadResponseAddr: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS5BadResponseAddr)

The address returned is not of a known type. This error code is only valid for errors in the `kCFStreamErrorSOCKSSubDomainNone` subdomain.

[`var kCFStreamErrorSOCKS5BadState: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKS5BadState)

The stream is not in a state that allows the requested operation. This error code is only valid for errors in the `kCFStreamErrorSOCKSSubDomainNone` subdomain..

[`var kCFStreamErrorSOCKSUnknownClientVersion: Int`](/documentation/CFNetwork/kCFStreamErrorSOCKSUnknownClientVersion)

The SOCKS server rejected access because it does not support connections with the requested SOCKS version. SOCKS client version. You can query the `kCFSOCKSVersionKey` key to find out what version the server requested. This error code is only valid for errors in the `kCFStreamErrorSOCKSSubDomainNone` subdomain.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)