zoukankan      html  css  js  c++  java
  • 使用curl测试网络通信

    Linux 工具命令
    使用curl测试网络通信

    #!/bin/bash
    cnt_pos=1
    while true
    do
       echo "--------------- the $cnt_pos requet ------------"
       echo "Start time: "`date +"%Y-%m-%d %H:%M:%S"`
       t0=`date +%s`
       req_url="https://www.baidu.com"
       echo "$req_url"
       
       curl -w "@./curl-cfg.txt" -X get -i --connect-timeout 200 -m 200  "$req_url"
       t1=`date +%s`
       let s_t2=t1-t0
       if [ $s_t2 -gt 3 ] 
       then
            break
       fi
       let cnt_pos=cnt_pos+1
       sleep 1s
    done
    

    curl-cfg.txt

    
    
             remote_ip: %{remote_ip}
    
           remote_port: %{remote_port}
    
              local_ip: %{local_ip}
    
            local_port: %{local_port}
    
             http_code: %{http_code}
    
                   dns: %{time_namelookup}s
    
              redirect: %{time_redirect}s
    
          time_connect: %{time_connect}s
    
       time_appconnect: %{time_appconnect}s
    
      time_pretransfer: %{time_pretransfer}s
    
    time_starttransfer: %{time_starttransfer}s
    
         size_download: %{size_download}bytes
    
        speed_download: %{speed_download}B/s
    
                      ----------
    
            time_total: %{time_total}s
    
    
    
    
  • 相关阅读:
    JSP学习-JSP访问数据库-JavaBean封装
    JSP学习-sessionDemo
    第十次随笔
    第九次随笔
    第八次随笔
    第七次随笔
    第六次随笔
    第五次随笔
    第四次随笔
    第三次随笔
  • 原文地址:https://www.cnblogs.com/iFanLiwei/p/13597875.html
Copyright © 2011-2022 走看看