actually, i'm writing on java (if it's big deal , java has specific methods solve problem, don't know, honest) irc protocol client, , have little lack of knowledge. have line read line irc server. line is:
line = reader.readline();
it works fine, i'm using line in loop, application freeze on line if server doesn't send anything. question is, how able break loop if, instance, server doesn't send 10 seconds?
i tried this
do { start = system.currenttimemillis(); line = reader.readline(); ... //doing other actions } while ((system.currenttimemillis() - start) < 10*1000);
and works when next response server... can't break loop after 10 seconds waiting, method wait forever if server doesn't send anything. that's problem, sorry if many mistakes or useless text, it's first question here:)
use socket.setsotimeout. can have sockettimeoutexception
after timeout.
Comments
Post a Comment