How can we create a BSD socket that binds on *.*, PortX and udp46?

One: does it involve below or any other steps?

  1. Create a socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
  2. Bind it to AF_INET6, in6addr_any, port X.
  3. Disable IPV6_V6ONLY using setsockopt.

Second: If answer to above is yes, in other operating system, if a datagram would have got received over IPv4, it would have lead to IPv4-mapped IPv6 address in the recvfrom call and protocol would have been considered udp6.

Third: is UDP46 only supported by Apple Kernel (is it not a POSIX standard behaviour) and also within Apple Kernel - not supported on all versions?

Why this question? We created a NWListener on a local port, using udp and when we ran a 'netstat -an -p udp', it showed protocol as 'udp46'

I’m much less familiar with this for UDP than I am for TCP. In TCP, support for unified IPv4 and IPv6 sockets is not an Apple addition but was inherited from our base BSD Sockets implementation, KAME [1]. I expect that the same is true for UDP.

Also, RFC 3493 has explicit affordance for this sort thing; Check out section 3.7 Compatibility with IPv4 Nodes.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] https://www.kame.net

How can we create a BSD socket that binds on *.*, PortX and udp46?
 
 
Q