局域网内测速这么写,怎么样?
服务器上写一个脚本,建立一个HTTP Server,返回大量数据:
#!/usr/bin/python
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class TestHTTPHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.protocal_version = "HTTP/1.1"
self.send_response(200)
self.send_header("Welcome", "Contect")
self.end_headers()
while 1:
self.wfile.write('A'*100000)
http_server = HTTPServer(('0.0.0.0', 8080), TestHTTPHandler)
http_server.serve_forever()
然后局域网内另一台机器:
wget http://xxx.xxx.xxx.xxx:8080/ -O /dev/null ----------------------- 以下是精选回复-----------------------
答:dd if =dev/zero | ssh target 'cat dev/null '
答:可以用iperf
服务端:
iperf -s
客户端:
iperf -c 192.168.1.xx
0条评论