The upper part of applet window is the universal client implemented over the socket interface. This client may be used to talk to any inet server that uses text-based protocol.
The lower part is a simple server, that receives a text line from a client and sends back an inverted line (something like "inverse echo").
It's better to use this applet as a standalone Java-application, because most WWW-browsers disable network operations by security reasons.
The source of the application (in Java).
It is the pair of console applications: the server and the client. Both use the standard BSDI socket interface for network operations.
The server listens to a port given in a command line (default is the port 1234), accepts a connection, sends the line "Hello!" to a remote client, receives a message from a client, and terminates.
The client connects to a remote server which Internet name and port are given in a command line, receives a message from a server, sends the message "Thanks! Bye-bye..." to a server, and terminates.
There is also an asynchronous implementation of a client (the file "asyncli.cpp") that uses the "select" system call to define whether any data is available for reading. So the "read" system call will not block in the case when there is no data.
The sources of the server/client/async.client examples in C++: