<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZFileHandleSerialPortAttachment/init(fileHandleForReading:fileHandleForWriting:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZFileHandleSerialPortAttachment(im)initWithFileHandleForReading:fileHandleForWriting:"
  },
  "title" : "init(fileHandleForReading:fileHandleForWriting:)"
}
-->

# init(fileHandleForReading:fileHandleForWriting:)

Creates a serial port attachment object from the specified file handles.

```
init(fileHandleForReading: FileHandle?, fileHandleForWriting: FileHandle?)
```

## Parameters

`fileHandleForReading`

The file handle that the guest operating system uses to read data. Your virtual machine writes data to this file handle. If the file descriptor for the file handle is invalid, this method raises an exception.

`fileHandleForWriting`

The file handle to which the guest operating system writes data. Your virtual machine reads data from this file handle. If its file descriptor for the file handle is invalid, this method raises an exception.

## Return Value

A serial port attachment object.

## Discussion

---

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)