I use the NAT address instead of the local interface address to bind socket call. I get this error - Bind error (99): Cannot assign requested address. Is there any configuration settings that can be used to pass the IP of NAT instead of the IP of system for binding. I am running the program on esxi.
struct addrinfo hints;
memset(&hints, 0, sizeof hints);
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_flags |= AI_PASSIVE;
getaddrinfo(NATIP.c_str(), "0", &hint, &myAddr);
bind(sock, myAddr->ai_addr, myAddr->ai_addrlen);
Please let me know if this is possible or not?