---
title: FileHandle.ConnectionAcceptedMessage
framework: foundation
role: symbol
role_heading: Structure
path: foundation/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.

## Declaration

```swift
struct ConnectionAcceptedMessage
```

## Overview

Overview Before adding an observer for this message type, call either acceptConnectionInBackgroundAndNotify() or acceptConnectionInBackgroundAndNotify(forModes:) on a FileHandle object that represents a server stream-type socket. Observe this message with the identifier connectionAccepted, or specify its type directly to the addObserver(of:for:using:) method. The Subject of this message type is FileHandle. This message interoperates with the notification NSFileHandleConnectionAccepted. The system notifies observers of the message when the NotificationCenter posts the notification. Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message

- [init(fileHandleItem:)](foundation/filehandle/connectionacceptedmessage/init(filehandleitem:).md)

### Working with message properties

- [fileHandleItem](foundation/filehandle/connectionacceptedmessage/filehandleitem.md)

## Relationships

### Conforms To

- [NotificationCenter.AsyncMessage](foundation/notificationcenter/asyncmessage.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Working with notification messages

- [FileHandle.DataAvailableMessage](foundation/filehandle/dataavailablemessage.md)
- [FileHandle.ReadCompletionMessage](foundation/filehandle/readcompletionmessage.md)
- [FileHandle.ReadToEndOfFileCompletionMessage](foundation/filehandle/readtoendoffilecompletionmessage.md)
