How does POC works?

There are 2 main classes: Client and Server.
I suppose that you know Socket and ServerSocket of JDK1.4.0. if you don't you must study it with JavaDoc avaible on sun website. Yuo must also know how Thread and Runnable iterface work. By the way let's go to analyse how POC works.
Client class instance a new Object: Access. This is a log-in GUI that implements Runnable interface. Access asks to user about Server IP and port where server is listen to. Then Access asks about your nickname. After this Access instance a new Object: Chat that is Runnuble.
Chat is a GUI for chat with other users. Run method of Chat instance an other Object: ChatClient, the only Object that can send messages to Server. Now ChatClient send (with Socket object) to Server a registration request using the nickname inserted by Access GUI. ChatServer can receive the message with his ServerSocket Object. ChatServer read the nickname and if it is already present reject Chat request. If Chat request is rejected Chat catch this exception, called UserDuplicatedException and throwed by ChatServer, and it display again Access GUI and propose a new nickname for user.
When a unique nick name is inserted ChatServer instance a new Object: ThreadServer. Now ChatServer is able to listen to other registration request. Now all ThreadServer can send and receve messages eachother, so evry users can Chat eachother. There are one Socket nad one ThreadServer for evry users. All ThreadServer are on server pc and Socket are on client pc. Server is a main program that instance (when is interpreted by java) ServerChat. ServerChat can instanced in more than one way. You can start Server in GUI mode or text mode, in background why not.

Here an image of classes in POC. This image is made by Bluej, an opensource tool of course!!! Logo