Dear Ranchers,
we have a server application which starts listening on a port for client connections. We are in the process of building fail-over mechanism into our application. We want to run two instances of this application on two machines, one in active mode and the other in passive mode. When the active server goes down for whatever reasons, the passive one picks up and starts servicing clients.
We were able to achieve notifications between the two servers without any problems, We are having a bit of a problem detecting this notification on the clients. If anybody could guide me in the right direction, that will be very helpful.
here's my server
thread's run method.
Whenever server recieves a client connection, we add this connection to a List. When the server recieves a de-active notification, we close all these sockets in the list and clear the list.
After the server has been de-activated, it should not accept any connections anymore, forcing the client to try and establish a connection to the other server. Client has this logic, if the attempt to establish a sockect connection is not successful for 3 attempts, it immediately tries to establish a connection to the other server.
This hasn't been working as expected, when I try to establish a cnnection to the passive server, instead of failing I was able to establish a connection.
Is it a better idea for the server to accept the client connection, and write the status, and let client decide to keep the connection or switch based on the status. On the server side, of course we can close the socket after writing the status info if the status is de-active.
Any suggestion is greatly appreciated.
Thanks for your time.
Cnu.
[ March 24, 2006: Message edited by: cnu sri ]