<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/kCFStreamPropertyShouldCloseNativeSocket",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@kCFStreamPropertyShouldCloseNativeSocket"
  },
  "title" : "kCFStreamPropertyShouldCloseNativeSocket"
}
-->

# kCFStreamPropertyShouldCloseNativeSocket

Should Close Native Socket property key.

```
let kCFStreamPropertyShouldCloseNativeSocket: CFString
```

## Discussion

If set to `kCFBooleanTrue`, the stream will close and release the underlying native socket when the stream is released. If set to `kCFBooleanFalse`, the stream will not close and release the underlying native socket when the stream is released. If a stream is created with a native socket, the default value of this property is `kCFBooleanFalse`. This property is only available for socket streams. It can be set by calling [`CFReadStreamSetProperty(_:_:_:)`](/documentation/CoreFoundation/CFReadStreamSetProperty(_:_:_:)) and [`CFWriteStreamSetProperty(_:_:_:)`](/documentation/CoreFoundation/CFWriteStreamSetProperty(_:_:_:)), and it can be copied by [`CFReadStreamCopyProperty(_:_:)`](/documentation/CoreFoundation/CFReadStreamCopyProperty(_:_:)) and [`CFWriteStreamCopyProperty(_:_:)`](/documentation/CoreFoundation/CFWriteStreamCopyProperty(_:_:)).

---

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)