V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Draplater
V2EX  ›  服务器

局域网内测速这么写,怎么样?

  •  
  •   Draplater · 2014-02-18 18:07:55 +08:00 · 3250 次点击
    这是一个创建于 3714 天前的主题,其中的信息可能已经有所发展或是发生改变。
    服务器上写一个脚本,建立一个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
    2 条回复    1970-01-01 08:00:00 +08:00
    pfitseng
        1
    pfitseng  
       2014-02-18 18:37:57 +08:00 via Android
    dd if =dev/zero | ssh target 'cat dev/null '
    little_cup
        2
    little_cup  
       2014-02-18 18:41:33 +08:00
    可以用iperf
    服务端:
    iperf -s
    客户端:
    iperf -c 192.168.1.xx
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2610 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 631ms · UTC 15:21 · PVG 23:21 · LAX 08:21 · JFK 11:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.