<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/CFSocketStreamSOCKSGetError(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFSocketStreamSOCKSGetError"
  },
  "title" : "CFSocketStreamSOCKSGetError(_:)"
}
-->

# CFSocketStreamSOCKSGetError(_:)

This function gets error codes in the `kCFStreamErrorDomainSOCKS` domain from the `CFStreamError` returned by a stream operation.

```
func CFSocketStreamSOCKSGetError(_ error: UnsafePointer<CFStreamError>) -> Int32
```

## Parameters

`error`

The error value to decode.

## 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 [`CFSocketStreamSOCKSGetError(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetError(_:)) returns the error code itself, which must be interpreted in the context of the result of a call to [`CFSocketStreamSOCKSGetErrorSubdomain(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetErrorSubdomain(_:)). Possible return values (beyond subdomain-specific values such as client versions and HTTP error codes) are listed in [Secure Sockets (SOCKS) Errors](/documentation/CFNetwork/1518266-secure-sockets-socks-errors).

---

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)