Question about getaddrinfo taking 20 seconds
Eugen Dedu
Eugen.Dedu@pu-pm.univ-fcomte.fr
Mon Jul 16 10:53:00 GMT 2012
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
More information about the Libc-help
mailing list