• Post Reply Bookmark Topic Watch Topic
  • New Topic

java socket setsotimeout explanation

 
akhil jhanwar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I have scenario in which there is server listening on specified ip and port and client which connects to that server. Now i am reading response from server using readline method(String readme=bs.readline()). Here bs is bufferedreader object. I want to know if before reading response if I write this line socket.setSoTimeout(1000) then if no response come till 1000 ms whether socket get timeout and get disconnected or it do not disconnect socket and give empty string in readme.

Please reply at earliest. Thanks in advance
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Javaranch, Akil Jhanwar.

Check if the issue is related to this one. The readLine() might wait for a end indicator to read a line. If not post the code that you may think is not working.

akhil jhanwar wrote:Please reply at earliest

Please EaseUp and read PatienceIsAVirtue
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!