java.net.sockettimeoutexception read timed out

mac2022-06-30  37

java.net.sockettimeoutexception read timed out

 

超时时间设长一点儿即可

Socket.setSoTimeout(int timeout);

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

注意下面几个超时时间(soTimeout只有100毫秒)

     /**      * The timeout of the read() of this socket's input stream (in milliseconds)      */      private  int soTimeout = 100;      /**      * timeout for connect and close      */      protected  long timeout = 60 * 1000;      /**      * retry timeout in millisecods      */      protected  int retryTimeout = 60 * 1000;      /**      * maximum retry timeout allowed      */      protected  int maxRetryTimeout = MAXRETRYTIMEOUT;

 

 

 

 

 

转载于:https://www.cnblogs.com/cuizhf/archive/2011/10/09/2203739.html

最新回复(0)