To alter a UDP socket program for vSockets, obtain the new address family to replace AF_INET.

int afVMCI = VMCISock_GetAFValue();
if ((sockfd_dgram = socket(afVMCI, SOCK_DGRAM, 0)) == -1) {
     perror("socket");
     goto exit;
}

VMCISock_GetAFValue() returns a descriptor for the vSockets address family if available.

This call is similar to the one for stream sockets, but has SOCK_DGRAM instead of SOCK_STREAM.