<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "vmnet",
  "identifier" : "/documentation/vmnet/vmnet_read(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "vmnet"
    ],
    "preciseIdentifier" : "c:@F@vmnet_read"
  },
  "title" : "vmnet_read(_:_:_:)"
}
-->

# vmnet_read(_:_:_:)

Attempts to read a specified number of packets from an interface.

```
func vmnet_read(_ interface: interface_ref, _ packets: UnsafeMutablePointer<vmpktdesc>, _ pktcnt: UnsafeMutablePointer<Int32>) -> vmnet_return_t
```

## Parameters

`interface`

The interface reference.

`packets`

On return, this parameter is populated with an array of packets read.

`pktcnt`

The number of packets to read.
On return, this parameter is populated with the number of packets read, or `0` no packets are available to be read.

## Return Value

Returns `vmnet` on success, or an error code on failure. See `vmnet` for possible values.

## Discussion

Each packet buffer passed should be at least as large as the value of [`vmnet_max_packet_size_key`](/documentation/vmnet/vmnet_max_packet_size_key) for the interface.

---

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)