This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Question about getaddrinfo taking 20 seconds
- From: Eugen Dedu <Eugen dot Dedu at pu-pm dot univ-fcomte dot fr>
- To: libc-help at sourceware dot org
- Date: Mon, 16 Jul 2012 12:53:06 +0200
- Subject: Question about getaddrinfo taking 20 seconds
Hi,
I have a dns-related question. The following program shows here 20
seconds, which means that getaddrinfo with AI_CANONNAME takes 20
seconds. Is it normal?
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <iostream>
using namespace std;
int main ()
{
struct timeval tv1, tv2;
gettimeofday (&tv1, NULL);
const char *name = "stun.ekiga.net";
cout << "start " << name << "\n";
struct addrinfo *res = NULL;
static struct addrinfo hints = { AI_CANONNAME, PF_INET };
getaddrinfo((const char *)name, NULL , &hints, &res);
gettimeofday (&tv2, NULL);
cout << "end, time elapsed: " << tv2.tv_sec - tv1.tv_sec << "secs\n";
return 0;
}
Thank you for your help,
--
Eugen Dedu
http://eugen.dedu.free.fr