why dig (tcp) is much faster than wget (gethostbyname?) ?

baobeileaf baobeileaf at gmail.com
Mon Nov 4 07:08:42 UTC 2013


hi guys,

check this out:

[root at localhost /]# time dig www.hyblr.com +tcp

; <<>> DiG 9.9.3-rl.156.01-P1-RedHat-9.9.3-3.P1.fc18 <<>> www.hyblr.com +tcp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35033
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hyblr.com.                 IN      A

;; ANSWER SECTION:
www.hyblr.com.          3       IN      A       111.8.98.138

;; AUTHORITY SECTION:
www.hyblr.com.          3518    IN      NS      ns2.hyblr.com.
www.hyblr.com.          3518    IN      NS      ns3.hyblr.com.
www.hyblr.com.          3518    IN      NS      ns1.hyblr.com.

;; Query time: 10 msec
;; SERVER: 111.8.14.18#53(111.8.14.18)
;; WHEN: Mon Nov 04 14:56:40 CST 2013
;; MSG SIZE  rcvd: 112


real    0m0.040s
user    0m0.014s
sys     0m0.018s

[root at localhost /]# time wget -O /dev/null  www.hyblr.com
--2013-11-04 14:55:18--  http://www.hyblr.com/
Resolving www.hyblr.com (www.hyblr.com)... 111.8.98.138
Connecting to www.hyblr.com (www.hyblr.com)|111.8.98.138|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘/dev/null’

    [ <=>                                                                                                                ] 81,980      --.-K/s   in 0.05s   

2013-11-04 14:55:33 (1.44 MB/s) - ‘/dev/null’ saved [81980]


real    0m15.203s
user    0m0.007s
sys     0m0.014s


I've read the sourcecode of wget. Maybe the difference comes from gethostbyname. 
Anyone can help me? or tell me where's the sourcecode of gethostbyname.
Much Thx.



baobeileaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/kde/attachments/20131104/5685f351/attachment.html>


More information about the kde mailing list