最新消息:

curl 连接超时,执行超时

curl admin 164浏览 0评论

连接超时

[root@aikaiyuan ~]# curl --connect-timeout 1 http://2.2.2.2
curl: (28) Connection timed out after 1001 milliseconds

连接超时

       --connect-timeout <seconds>
              Maximum time in seconds that you allow curl's connection to take.  This only limits the connection phase, so if curl connects within the
              given period it will continue - if not it will exit.  Since version 7.32.0, this option accepts decimal values.

              If this option is used several times, the last one will be used.

              See also -m, --max-time.

最大执行时间

[root@aikaiyuan ~]# curl --max-time 2 http://2.2.2.2
curl: (28) Operation timed out after 2005 milliseconds with 0 bytes received

curl 最大执行时间, 有时候连接成功了, 但服务端长时间未返回,可以使用 max-time

       -m, --max-time <seconds>
              Maximum time in seconds that you allow the whole operation to take.  This is useful for preventing your  batch  jobs  from  hanging  for
              hours  due to slow networks or links going down.  Since 7.32.0, this option accepts decimal values, but the actual timeout will decrease
              in accuracy as the specified timeout increases in decimal precision.

              If this option is used several times, the last one will be used.

              See also --connect-timeout.

转载请注明:爱开源 » curl 连接超时,执行超时

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址