Hi, On the same topic.... who is responsible for freeing the struct hostent structure returned by gethostbyname? Thanks Lee --- Mark Hahn <hahn@coffee.psychology.mcmaster.ca> wrote: > > gethostbyname just takes too long once in a while > on > > certain sites... is there a way to set a time out > for > > gethostbyname? > > that's the right approach, I think. you might try > plain old signal(connect_timeout,SIGALRM), since > the sigaction stuff is somewhat complicated. > > > I tried this: > > act.sa_flags = SA_NOMASK; > > act.sa_handler = connect_timeout; > > sigaction(SIGALRM, &act, NULL); > > alarm(DNS_TIMEOUT); > > hostentry = gethostbyname(host); > > alarm(0); > > > > but when the alarm happened, I got a SIGSEGV in > > gethostbyname > > could you strace this? gethostbyname is actually a > libc > thing, so it could well be that libc is simply not > dealing > with some syscall (probably a sendmsg to a > nameserver) > getting EINTR. > __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org