Reconnecting Chat Client

S

Sameer

I have a simple working chatting system.
The Server waits for connection in non-blocking mode.
Client connects to server and both communicate with an established
SocketChannel.
Client accepts text from a textfield, send it to server, server send it
to all other connected clients.
Client appends the message coming from other clients to a text area.
This all system works well.

Let us suppose that server shuts down.
This will lead to an IOException at client and client closes the
established SocketChannel. There is some other stuff associated with
this channel in the system at client side.
When the server starts and we establish a new SocketChannel with the
server by providing Servername and port, it will be a total new channel
and it did not respond with the previous system.
I dont want to close the client and start new instance of the client.
I just want to put one "ReConnect" button which will establish a new
connection with the server and will also respond with the other objects
in the system.
I observed that starting a new instance of this client in a new thread
and disposing the window of previous one also won't work.
What to do?
Please help me in this matter.

-Sameer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top