Socket.setSoTimeout problem
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Al_G
Posted On:   Tuesday, October 30, 2001 06:26 PM

Hi ! I am working with Sockets but I get problems with setSoTimeout method, after an IOException is raised I can not read anymore any data from the socket even if there is incoming data, it always return "null". Supose that this is code from client: Socket.setSoTimeout(1000); . . while (!stop){ try { b = input.readByte(); } catch (IOException ie){ " send data to server " } } When timeout occurs throws en IOexception, sends some data to server, the server responds and sends data to client, in the next loop this incoming data is no read by "input.readByte()" it always return an IOException with mes   More>>

Hi !
I am working with Sockets but I get problems with setSoTimeout method, after an IOException is raised I can not read anymore any data from the socket even if there is incoming data, it always return "null".
Supose that this is code from client:


Socket.setSoTimeout(1000);
.
.

while (!stop){
try {
b = input.readByte();
}
catch (IOException ie){
" send data to server "
}

}


When timeout occurs throws en IOexception, sends some data to server, the server responds and sends data to client, in the next loop this incoming data is no read by "input.readByte()" it always return an IOException with message "null" in the entire loop no matter that the server sends data.
It seems after the first IOException the socket becomes closed or useless.
Java Class docs says that after exception is raised the socket is still valid.
Thanks and regards.

   <<Less
About | Sitemap | Contact