Receiving request timeout even though connect timeout and read timeout is set to default (infinite)?

后端 未结 3 1796
Happy的楠姐
Happy的楠姐 2021-01-25 04:47

I am connecting to a web service and did not set any connect timeout and read timeout on HttpURLConnection. What is the default connect timeout and read timeout? Is it dependent

3条回答
  •  旧巷少年郎
    2021-01-25 05:38

    If the getConnectTimeout and getReadTimeout from the object return zero, then that does indeed mean infinity. This is inherited from the underlying URLConnection class.

    It may be that the exception you're receiving is not a SocketTimeoutException at all, you should verify this - it's possible to get IOException thrown regardless of the timeout settings.

提交回复
热议问题