Speedtest-cli

今天网速慢得可以,突然想起一个Linux工具speedtest,看看MAC下是否有,试了下,果然我大brew威武,想想这作者还去面试Google,还写翻转二叉树……

lihui@MacBook  ~  brew install speedtest-cli
==> Downloading https://github.com/sivel/speedtest-cli/archive/v0.3.4.tar.gz
==> Downloading from https://codeload.github.com/sivel/speedtest-cli/tar.gz/v0.3.4
######################################################################## 100.0%
🍺  /usr/local/Cellar/speedtest_cli/0.3.4: 6 files, 42.0K, built in 23 seconds

这工具原理很简单,找到离你较近的speedtest.net服务器,然后通过GET/POST等来测试上传下载网速

简单试了下,居然还超时了,这网速也是醉了

lihui@MacBook  ~  speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Traceback (most recent call last):
  File "/usr/local/bin/speedtest-cli", line 796, in 
    main()
  File "/usr/local/bin/speedtest-cli", line 790, in main
    speedtest()
  File "/usr/local/bin/speedtest-cli", line 641, in speedtest
    servers = closestServers(config['client'])
  File "/usr/local/bin/speedtest-cli", line 436, in closestServers
    serversxml.append(uh.read(10240))
  File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
  File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 612, in read
    s = self.fp.read(amt)
  File "/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
socket.timeout: timed out

再来一次,结果出来了

✘ lihui@MacBook  ~  speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from China Telecom (115.200.217.141)...
Selecting best server based on latency...
Hosted by China Telecom (Shanghai) [162.85 km]: 10.82 ms
Testing download speed........................................
Download: 1.47 Mbit/s
Testing upload speed..................................................
Upload: 4.51 Mbit/s

这网速,至少下载速度和正常相比,慢了几十倍,坑爹~!

发表回复