understanding URLConnection.setReadTimeout()

后端 未结 3 1254
日久生厌
日久生厌 2020-12-17 09:16

Consider the following snippet:

URLConnection connection = target.openConnection();

connection.setConnectTimeout(5000); // 5 sec
connection.setReadTimeout(1         


        
3条回答
  •  我在风中等你
    2020-12-17 10:01

    you are right! connection.setReadTimeout not mean read complete, it mean when wait for 10s, when there're no more data read in, will throw a timeoutexception.

提交回复
热议问题