开发者

Bandwidth test, delay test using urllib2

开发者 https://www.devze.com 2023-01-07 17:08 出处:网络
I want to make a python script that tests the bandwidth of a connection. I am thinking of downloading/uploading a fil开发者_高级运维e of a known size using urllib2, and measuring the time it takes to

I want to make a python script that tests the bandwidth of a connection. I am thinking of downloading/uploading a fil开发者_高级运维e of a known size using urllib2, and measuring the time it takes to perform this task. I would also like to measure the delay to a given IP address, such as is given by pinging the IP. Is this possible using urllib2?


You can use PyCurl for this. curl_easy_getinfo gives info about: CURLINFO_TOTAL_TIME, CURLINFO_NAMELOOKUP_TIME, CURLINFO_CONNECT_TIME, CURLINFO_PRETRANSFER_TIME etc.


You could download an empty file to measure the delay. You measure more the only the network delay, but the difference should be too big I expect.

0

精彩评论

暂无评论...
验证码 换一张
取 消