<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZNetworkBlockDeviceStorageDeviceAttachmentDelegate/attachmentWasConnected(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(pl)VZNetworkBlockDeviceStorageDeviceAttachmentDelegate(im)attachmentWasConnected:"
  },
  "title" : "attachmentWasConnected(_:)"
}
-->

# attachmentWasConnected(_:)

The method the attachment object calls when the NBD client successfully connects or reconnects with the server.

```
optional func attachmentWasConnected(_ attachment: VZNetworkBlockDeviceStorageDeviceAttachment)
```

## Parameters

`attachment`

The attachment object calling the delegate method.

## Discussion

Connection with the server takes place when the VM is first started, and reconnection attempts take place when the connection times out or when the NBD client has encountered a recoverable error, such as an I/O error from the server. The Virtualization framework may call this method multiple times during a VM’s life cycle. Reconnections are transparent to the guest.

---

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)