I have a java server that serve many clients using Sockets
In case of a failure of the main server I wanted a back server to take over automaticaly.
What I did is, I put the ip address and the port of the back up server in the client side and when a timeout occure I just connect to the back up server.
Is it the right decision or I should put the backup server coordinates on the server side and transfer it to the client when it connect ?
Thanks
Having the server send a backup address to the client is a good idea, it is easier to administer this data centrally.
The backup server addresses should be in a property file on the client too however (or in a central configuration databse read by the clients and servers), otherwise it cannot find the backup when it starts while the primary is down.