Как разрешить IP в хост с помощью c-ares?

Это то, что я сделал до сих пор. Он компилируется, но при запуске происходит сбой.

#include <iostream>
#include <netdb.h>
#include <arpa/inet.h>
#include <ares.h>

void dns_callback (void* arg, int status, int timeouts, struct hostent* host)
  {
    std::cout << host->h_name << "\n";
  }

int main(int argc, char **argv)
  {
    struct in_addr ip;
    char *arg;
    inet_aton(argv[1], &ip);
    ares_channel channel;
    ares_gethostbyaddr(channel, &ip, 4, AF_INET, dns_callback, arg);
    sleep(15);
    return 0;
  }
7
задан Daniel Stenberg 22 May 2012 в 12:36
поделиться