There is a server and an android device on the same WI-FI network. Android creates a connection (socket) with the server and sends data. How to determine on an android device if the TCP connection is interrupted? After all, the android will continue to send info.
UPADTE: An interesting observation is that the methods of the class Socket isClosed and isConnected do not work as one might think. isConnected - if the connection has been created, the method will always return true isClosed - will return false only when the close() method is called from the client, not the server. We continue the search ..
UPDATE 2: Found an interesting checkError() method in PrinterWriter , which PrinterWriter True if it is not possible to send a message over a TCP connection. But here are its pitfalls: If the connection is broken, the android sends a message, for the first time checkError() returns false , and true only the next times (provided that the connection is still broken).