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

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

问题描述

setSocketTimoutsetConnectTimoutsetConnectionRequestTimeout有什么区别?

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天全站免登陆