<!--
{
  "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/CFSocketStreamSOCKSGetErrorSubdomain(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFSocketStreamSOCKSGetErrorSubdomain"
  },
  "title" : "CFSocketStreamSOCKSGetErrorSubdomain(_:)"
}
-->

# CFSocketStreamSOCKSGetErrorSubdomain(_:)

Gets the error subdomain associated with errors in the `kCFStreamErrorDomainSOCKS` domain from the `CFStreamError` returned by a stream operation.

```
func CFSocketStreamSOCKSGetErrorSubdomain(_ 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 [`CFSocketStreamSOCKSGetErrorSubdomain(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetErrorSubdomain(_:)) returns an identifier that tells which layer of the protocol stack produced the error. The possible values are listed under Data Types in <doc://com.apple.documentation/documentation/CoreFoundation/cfstream>. With this information, you can interpret the error codes returned by [`CFSocketStreamSOCKSGetError(_:)`](/documentation/CFNetwork/CFSocketStreamSOCKSGetError(_:)).

---

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)