<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSNotification/Name-swift.struct/NSFileHandleConnectionAccepted",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSFileHandleConnectionAcceptedNotification"
  },
  "title" : "NSFileHandleConnectionAccepted"
}
-->

# NSFileHandleConnectionAccepted

Posted when a file handle object establishes a socket connection between two processes, creates a file handle object for one end of the connection, and makes this object available to observers.

```
static let NSFileHandleConnectionAccepted: NSNotification.Name
```

## Discussion

To cause the posting of this notification, you must send either [`acceptConnectionInBackgroundAndNotify()`](/documentation/Foundation/FileHandle/acceptConnectionInBackgroundAndNotify()) or [`acceptConnectionInBackgroundAndNotify(forModes:)`](/documentation/Foundation/FileHandle/acceptConnectionInBackgroundAndNotify(forModes:)) to an `NSFileHandle` object representing a server stream-type socket.

The notification object is the `NSFileHandle` object that sent the notification. The `userInfo` dictionary contains the following information:

|Key                                     |Value                                                                                      |
|----------------------------------------|-------------------------------------------------------------------------------------------|
|`NSFileHandleNotificationFileHandleItem`|The `NSFileHandle` object representing the “near” end of a socket connection.              |
|`@"NSFileHandleError"`                  |An `NSNumber` object containing an integer representing the UNIX-type error which occurred.|

---

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)