KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is what I've done so far. It compiles, but it segfaults when I try to run it. #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; }
Tags (comma-separated)
Save Edits
Cancel