Reading and Writing From Sockets
Sockets in Java are full duplex--meaning that they can both send and receive information.
A good example of this feature is an echo client. The echo service listens to Port 7, and simply returns or ‘echoes back’ all information received from the client.
An echo client, therefore, has to be able to send and receive over the same socket.
Let’s look at an echo client written by Sun. . . .