The following are networking applications. Download; compile; run
(must be online).
Http.java - retrieves a web page from
a web server
Page.java - displays my homepage on
System.out WhoAmI.java - displays your IP address;
see source code for usage
The following pair of networking applications are run as follows:
download each source file
compile each source file
if not online, go online. i.e., connect to an ISP (if in lab, you're
always online)
enter java JabberServer
open a second command prompt window and go to the folder where the files
are
enter java JabberClient
watch the action
JabberServer.java - very simple
server that just echoes whatever the client sends
JabberClient.java - very simple
client that just sends lines to the server and reads lines that the server
sends
Do at least two of the following modifications to the JabberServer JabberClient
app:
Enhance the JabberServer by adding the ability to handle more than one
connection at a time. Use multithreading. When a connection is accepted,
create a "worker" thread and pass it the socket. The worker thread then
handles further communication with the client.
Enhance JabberServer so that instead of printing the data received from
the client to System.out, it displays it in a GUI.
Enhance the JabberClient by adding the ability to get text from the user
and then send it to the server. Use a GUI with an area where the user can
input the text. You may want to add a send button or perhaps the enter
key will suffice.
Change the JabberServer so that instead of echoing back the text received
from the client, it gets input from the (server) user and sends that to
the client. Notice that this functionality is described in the previous
item, but here you are adding it to the server.
Note that if you make all four changes you should now have a chat app.
If you plan to do all of the enhancements, you will probably want to "architect"
it first. Note that there is some functionality that is common to both
the client and server. Factor that out and put it in a separate class.
Should be fun.