Hoping to revive this thread. I'm getting NWEndpoint from NWBrowser and trying to force IPv4.
let parameters = NWParameters.udp
parameters.includePeerToPeer = true
(parameters.defaultProtocolStack.internetProtocol! as! NWProtocolIP.Options).version = .v4
But checking to see if parameters.defaultProtocolStack.internetProtocol! as! NWProtocolIP.Options).version == .v4 returns false. It doesn't seem to be setting the version as expected. I checked and it remains as any.
It seems like NWProtocolUDP.Options() and NWProtocolTLS.Options() initializers exist but NWProtocolIP.Options does not have an init exposed so I can't try setting
params.defaultProtocolStack.internetProtocol = NWProtocolIP.Options() // and set version on options before assigning here
Topic:
App & System Services
SubTopic:
Networking
Tags: