<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileHandle/ConnectionAcceptedMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So12NSFileHandleC10FoundationE25ConnectionAcceptedMessageV"
  },
  "title" : "FileHandle.ConnectionAcceptedMessage"
}
-->

# FileHandle.ConnectionAcceptedMessage

A message a file handle sends when it creates a socket connection between two processes and creates a file handle for one end of the connection.

```
struct ConnectionAcceptedMessage
```

## Overview

Before adding an observer for this message type, call either [`acceptConnectionInBackgroundAndNotify()`](/documentation/Foundation/FileHandle/acceptConnectionInBackgroundAndNotify()) or [`acceptConnectionInBackgroundAndNotify(forModes:)`](/documentation/Foundation/FileHandle/acceptConnectionInBackgroundAndNotify(forModes:)) on a [`FileHandle`](/documentation/Foundation/FileHandle) object that represents a server stream-type socket.

Observe this message with the identifier [`connectionAccepted`](/documentation/Foundation/NotificationCenter/MessageIdentifier/connectionAccepted), or specify its type directly to the `addObserver(of:for:using:)` method.
The [`Subject`](/documentation/Foundation/NotificationCenter/MainActorMessage/Subject) of this message type is [`FileHandle`](/documentation/Foundation/FileHandle).

This message interoperates with the notification [`NSFileHandleConnectionAccepted`](/documentation/Foundation/NSNotification/Name-swift.struct/NSFileHandleConnectionAccepted).
The system notifies observers of the message when the [`NotificationCenter`](/documentation/Foundation/NotificationCenter) posts the notification.
Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message

[`init(fileHandleItem: Result<FileHandle, POSIXError>)`](/documentation/Foundation/FileHandle/ConnectionAcceptedMessage/init(fileHandleItem:))

Creates a message for a file handle connection acceptance.

### Working with message properties

[`var fileHandleItem: Result<FileHandle, POSIXError>`](/documentation/Foundation/FileHandle/ConnectionAcceptedMessage/fileHandleItem)

A result instance that contains either the file handle representing the “near” end of a socket connection, or an error.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`AsyncMessage`](/documentation/Foundation/NotificationCenter/AsyncMessage)

---

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)