Virtualization.Framework support for VZFileHandleNetworkDeviceAttachment

Hi,

I am trying to create a virtual-machine using Virtualization.Framework (Apple Developer Documentation) and trying to use VZFileHandleNetworkDeviceAttachment (Apple Developer Documentation) as network device.


The creation and starting of VM are successful but am not receiving any raw packets via the created datagram socket.


Is there any working example for using VZFileHandleNetworkDeviceAttachment.

Thanks in advance.

Posted on Mar 15, 2022 9:41 AM

Reply
5 replies

Mar 15, 2022 11:48 AM in response to balaji1103

Actually I was thinking of the basic networking entitlement, not the vm network entitlement.


Which project are you using? I mentioned a GitHub project and the Apple samples. The Apple samples aren't sandboxed, which is kind of unusual for Apple. But if you create a new project from scratch, it will be sandboxed.


If that's not the problem, then you might want to try a little project that only does datagram sockets. That is a bit unusual. Most people use HTTP these days and have no idea about lower-level protocols. Plus, doing this in the context of a Mac app is an entirely different question. Throw out everything you can find on the internet about doing datagram sockets and figure out how you would do that on a Mac. Last, and certainly not least, this would be acceptable as a demo project you are just playing around with, but DO NOT use NSFileHandle in a real app.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Virtualization.Framework support for VZFileHandleNetworkDeviceAttachment

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.