how to detect when server gets down!
I'm creating simple TCP server/client chat, when a client sends a text
the server receives it and sends it to all connected clients
I want to create redundant server, when one server gets down, clients should connect to the
second server automatically,
how to use RMI to achieve this! I want the client side detects when the server is down at any time and directly connect to the other one
This is what I have currently:
server side:
first class:
accepts new socket from client and add it to arrayList of sockets
create object of ClientThread that implements
thread, and pass the socket to it
second class:
Extends Thread and has run() method which receives text from one client and loop through the ArrayList of
sockets that created in first class and send to all connected sockets.
the ArrayList in first class is public and I access it like:
Client side:
has only one class that extends JFrame and implements AcionListener,
- it has a method that create sockets to server,and read any thing comes from server
- sending text to server is in actionPerform of Send button