Apache HTTP - setSocketTimout 与 setConnectTimout 与 setConnectionRequestTimeout [英] Apache HTTP - setSocketTimout vs setConnectTimout vs setConnectionRequestTimeout

查看:25
本文介绍了Apache HTTP - setSocketTimout 与 setConnectTimout 与 setConnectionRequestTimeout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

setSocketTimoutsetConnectTimoutsetConnectionRequestTimeout 有什么区别?

What is the difference between setSocketTimout, setConnectTimout and setConnectionRequestTimeout?

RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
            .setSocketTimeout(500)
            .setConnectTimeout(500)
            .setConnectionRequestTimeout(500)
            .build();

推荐答案

Connection timeout与服务器的连接建立之前的超时时间.

Connection timeout is the timeout until a connection with the server is established.

Socket timeout接收数据的超时时间.

setConnectionRequestTimeout 方法专门用于配置连接管理器.它返回从连接管理器请求连接时使用的超时时间(以毫秒为单位).超时值为零被解释为无限超时.

The method setConnectionRequestTimeout however is specific for configuring the connection manager. It returns the timeout in milliseconds used when requesting a connection from the connection manager. A timeout value of zero is interpreted as an infinite timeout.

这篇关于Apache HTTP - setSocketTimout 与 setConnectTimout 与 setConnectionRequestTimeout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆