My server is on android , there may be no wifi over which data goes.

The server only reads the string!

On sockets.

If suddenly my server drops, how can I notify the client that I no longer need to send anything?

Logical move will send from the server "1", everything is OK. If 1 did not come to the client, then the server is unavailable. But can it be done differently? I do not want to send anything to the client.

    1 answer 1

    Logical move will send from the server "1", everything is OK. If 1 did not come to the client, then the server is unavailable. But can it be done differently? I do not want to send anything to the client.

    If the server is down, the lack of response will be the answer in the application. Set the time during which you are waiting for a response from the server and process it afterwards.

    Why restrict a user to a fallen server. Save user messages inside the application and when "everything will be fine" send to the server.

    Those. I understand correctly. What I can not do without a response from the server? In any case, my server (smartphone) must tell the client that I am working, or say nothing, for it has fallen. And then the client will reconnect.

    The lack of a response from the server - you define yourself, in the client application, the server has dropped, the time for the necessary response has expired.

    You think through in advance how the client application behaves. No response in the client application? - "Sorry, we are already working on the issue, soon everything will be fine."

    What will the client reconnect to? To another server? All in your hands.

    • Those. I understand correctly. What I can not do without a response from the server? In any case, my server (smartphone) must tell the client that I am working, or say nothing, for it has fallen. And then the client will reconnect. - Roman Aymaletdinov
    • And doesn’t the client self-test that the server is unavailable when you try to send to it (write to a closed socket)? - Morewind