Friday 15 July 2011

urllib - python urlopen opens faster with slower internet? -



urllib - python urlopen opens faster with slower internet? -

i trying create programme read webpage website. info read 18kb. have college wifi connection fast (2 mbps) , has proxy server running.

when seek run code:

import urllib data=urllib.urlopen("http://www.google.com")

it takes 8 10 sec run (the same link opens fast in web-browser)

however, when run same code on other net connection not fast college wifi, code runs in less second.

i confused why slower on wifi. because of proxy server? if because of that, why same link taking less time open in browser.

thanks in advance

download 18kb file not representative of net connection speed. little file size, we're looking efficient latency.

launch urllib.urlopen("http://www.google.com") create lots of action behind scene. create few examples:

it request dns convert www.google.com ip maybe google can redirect you, https example any node between , server can play in request time (proxy, qos)

however, troubleshoot problem, suggest utilize traceroute (icmp) , traceproto see latency between you, google , every node between both. example:

$ traceroute google.com traceroute google.com (173.194.40.135), 30 hops max, 60 byte packets 1 par10s10-in-f7.1e100.net (173.194.40.135) 18.142 ms 18.116 ms 18.111 ms

but think in network communication, must care elements of osi model

python urllib

No comments:

Post a Comment