This code shows how to implement a client-server code on JAVA
The server is attached with a listener which listens to a specific port number. Whenever a suitable handshake is received from a listener, another listener is created. The new listener listen to the request made by that particular client.
The client sends the requests to the server via the listener.
Start using this code by clicking here.