JAVA: Обработка разъединения розетки
Two computers are connected by socket connection. If the server/client closes the connection
from their end(i.e closes the
InputStream
, OutputStream
and Socket
) then how can I inform
the other end about the disconnection? There is one way I know of - trying to read from the InputStream
,
which throws an IOException
if connection is closed, but is there any other way to detect this?
Another question, I looked the problem up on the internet and saw inputStream.available()
does not solve this problem. Why is that?
Additional Information : Я прошу другой путь, потому что мой проект становится трудным для обработки, если мне нужно попытаться прочитать из
InputStrem
обнаружить отключение.