Using TCP for DNS queries on Linux

Mark_Andrews at isc.org Mark_Andrews at isc.org
Fri Jan 11 23:35:32 UTC 2002


> 
> 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()
> {

	Well at the very least you should call res_init() before setting
	the flags.

>         _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
> 
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org


More information about the bind-users mailing list