首页 > Web开发 > 详细

curl的超时时间设置

时间:2015-10-17 19:22:56      阅读:581      评论:0      收藏:0      [点我收藏+]



curl的超时时间设置


使用curl时,有两个超时时间:一个是连接超时时间,另一个是数据传输的最大允许时间。

 

连接超时时间: --connect-timeout 

    例:

    curl --connect-timeout 1 "http://localhost/index.html"

    出错提示形如:

    curl: (28) connect() timed out!

    

    不能连接提示如:

    curl:(7) couldn‘t connect to host


数据传输的最大允许时间用: -m 

    例:

    curl --connect-timeout 1 -m 20 "http://localhost/index.html"

    

    数据传输的最大允许时间超时的话,出错提示形如:

    curl: (28) Operation timed out after 2000 milliseconds with 0 bytes received

    
用途:

    可用在判断某资源是否可以访问,例如lvs的健康状态监测

curl的超时时间设置

原文:http://dengxi.blog.51cto.com/4804263/1703731

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!