I am working on a client application that talks to the server through socket and exchange messages. Basically, it is a request response model. Client send requests and get results from the server. My client is a library that is loaded by another process. So, that process(say P1) communicate with the Server process(P2) using client library.
The library should indicate to P1 whenever the connection with P2 goes down.( For example, the server is reset).
How do I do this? Should I have another thread that checks if the connection is up periodically?