In my app, I want to resolve an address with a DNS server address of my choice (the DNS isn't mine, I just want to decide at which DNS the app is going to use).
I have this code (below) but I always gets the error "nodename nor servname provided, or not known".
What am I doing wrong?
Is it even possible?
here is the code I'm using, it's quite short and implemented in C.
dns_server_s is the IP of the DNS server I want to use, and the node is the address I want to resolve via this DNS
int my_getaddrinfo(const char *dns_server_s, const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) {
    struct in_addr dns_server;
    struct sockaddr_in dns_server_sock;
    int ret = inet_pton(AF_INET, dns_server_s, &dns_server);
    if (ret != 1) {
        return -1;
    }
  
    dns_server_sock.sin_family = AF_INET;
    dns_server_sock.sin_port = htons(53);
    dns_server_sock.sin_addr = dns_server;
  
    if (!(_res.options & RES_INIT)) {
        struct addrinfo hh, *servinfo;
        memset(&hh, 0, sizeof(hh));
        getaddrinfo("google.com", NULL, &hh, &servinfo);
        freeaddrinfo((struct addrinfo*)servinfo);
    }
  
    _res.nscount = 1;
    _res.nsaddr_list[0] = dns_server_sock;
  
    ret = getaddrinfo(node, service, hints, res);
  
    res_init();
  
    return ret;
}