I did setup it succesfully with socketpair() like below:
let socket_vector = Array<Int32>(unsafeUninitializedCapacity: 2) { buffer, initializedCount in
guard Darwin.socketpair(AF_UNIX, SOCK_DGRAM, 0, buffer.baseAddress) == 0 else {
assertionFailure(String(cString: Darwin.strerror(errno)!))
initializedCount = 0
return
}
initializedCount = 2
}
for socket_descriptor in socket_vector {
let virtioSocketNet = VZVirtioNetworkDeviceConfiguration()
let fh = FileHandle(fileDescriptor: socket_descriptor)
virtioSocketNet.attachment = VZFileHandleNetworkDeviceAttachment(fileHandle: fh)
config.networkDevices += [virtioSocketNet]
}
I struggle to send/receive anything with it.
Does anyone happen to have a working netcat/socat command that successfully sends anything?
I use Linux as a guest system, and interfaces register as enp0s2, enp0s3
Topic:
App & System Services
SubTopic:
Networking
Tags: