java - How does socket.setSoTimeout works? -


i have code service:

  inputstream readein = socket.getinputstream();     char [] buffer = new char[1024];      bufferedreader in = new bufferedreader(new inputstreamreader(readein));      while((counter = in.read(buffer)) != -1)     {      socket.setsotimeout(300000);      //read here     } 

i ask 2 questions:

  • if, after 300000 milliseconds, doesn't read anything, there exception?
  • every time while loop comes up, refreshes socket timeout? example read time out @ 100 seconds, when comes return @ 300 seconds?

thank answers.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -