How can a client gracefully detect when a server disconnects?

Posted by Ummar on Stack Overflow See other posts from Stack Overflow or by Ummar
Published on 2009-11-02T13:10:15Z Indexed on 2010/05/09 20:48 UTC
Read the original article Hit count: 178

Filed under:
|

I am working on a client-server application. The client continuously reads data from server, so when a server is closed or disconnects then the client crashes. I tried a try/catch block, but it didn't work. My client application is written in C++. I want the client to display some proper message like "Server disconnected," then exit.

© Stack Overflow or respective owner

Related posts about c++

Related posts about exception-handling