<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZVirtioSocketConnection",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZVirtioSocketConnection"
  },
  "title" : "VZVirtioSocketConnection"
}
-->

# VZVirtioSocketConnection

A port-based connection between the guest operating system and the host computer.

```
class VZVirtioSocketConnection
```

## Overview

A [`VZVirtioSocketConnection`](/documentation/Virtualization/VZVirtioSocketConnection) object contains the port information for the guest operating system and host computer. You don’t create connection objects directly. When the guest operating system initiates a connection, the virtual machine creates the connection object and passes it to the appropriate [`VZVirtioSocketListener`](/documentation/Virtualization/VZVirtioSocketListener) object, which forwards the object to its delegate. When the virtual machine opens a connection to a guest port, the [`connect(toPort:)`](/documentation/Virtualization/VZVirtioSocketDevice/connect(toPort:)) method (Objective-C) or [`connect(toPort:completionHandler:)`](/documentation/Virtualization/VZVirtioSocketDevice/connect(toPort:completionHandler:)) method (Swift) pass the connection object to your completion handler.

## Topics

### Getting the connection details

[`sourcePort`](/documentation/Virtualization/VZVirtioSocketConnection/sourcePort)

The port number of the system that opened the connection.

[`destinationPort`](/documentation/Virtualization/VZVirtioSocketConnection/destinationPort)

The destination port number of the connection.

[`fileDescriptor`](/documentation/Virtualization/VZVirtioSocketConnection/fileDescriptor)

The file descriptor to use when sending data.

### Closing the connection

[`close()`](/documentation/Virtualization/VZVirtioSocketConnection/close())

Close the file descriptor associated with the socket.



---

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)