Using TCP for DNS queries on Linux
Kevin Darcy
kcd at daimlerchrysler.com
Fri Jan 11 23:46:34 UTC 2002
I'm seeing the same behavior on Solaris. I suspect that
gethostbyname() re-initializes the resolver, so basically you're losing all of
the changes you made to the _res variable.
If that's the case, then you may need to use the lower-level resolver routines
instead of gethostbyname().
- Kevin
Ajay kumar Dwivedi wrote:
> hi all,
> I am trying to force resolver to use TCP instead of UDP on RH linux
> 7.0, gcc 2.96, glibc 2.2.1-1. I have written this small program:
>
> #include<resolv.h>
> #include<netdb.h>
> main()
> {
> _res.options |= RES_USEVC;
> _res.options |= RES_STAYOPEN;
> gethostbyname("www.google.com");
> }
>
> However tcpdump shows that it is still using udp. Everytime I run this
> program, "tcpdump udp port 53" shows packets going in and out. "tcpdump tcp
> port 53" does not show any activity.
>
> I have also tried sethostent(1) without success.
>
> What am I missing?
>
> Thanks in advance.
> --
> #! If anything can go wrong, _FIX_ it. (To hell with MURPHY)
> Ajay kumar Dwivedi
More information about the bind-users
mailing list