Java
This is a legacy page I’m retaining until I decide to either scrap it completely. First wrote this around 2002.
I started with Java in university (1998) and with JavaScript about 2 years prior. I soon started playing with *Java2 Enterprise Edition* (J2EE) including:
* *Java Database Connectivity* (JDBC)
* *Java Servlets*
* *Java Server Pages* (JSP)
As soon as I can get a host with a java-based server, I intend to post some projects along these lines.
Additionally, I have worked extensively with *Java2 Standard Edition* (J2SE) to build _applications, servers, clients, applets and interfaces_, a few of which I will post here.
Although *JavaScript* belongs in the Web section alongside DOM, I have developed some pure JavaScript functions for validation and verification of form data. Some of the work with JavaScript also MS *JScript*, which I will also include here.
Java Chat Application
The following is a java chat application/applet which start off with just a cool interface, feature below. The application went through many architectural changes described below the interface.
Very Basic command line client/server
The application acts as a client and a server, listening on a particular port and transmitting on a port it’s bounded to. This is at the most basic level of functionality, and only two clients can converse at a time.
Generic.java (3.76KB)
Generic.class (3.76KB)
To run the application:
~> java Generic
example of starting two instances communicating in two separate consoles:
console1> java Generic 31000 Port to connect to: 32000 console2> java Generic 32000 Port to connect to: 31000
All messages typed in either console will be exchanged
Centralized Message Server with Multiple Clients
The next natural step was to allow multiple clients to communicate
through a central server responsible for handling messages. This brings
in a lot of added capability:
* A central server can filter messages (block messages from people on ignore lists, filter profanity etc at the server level).
* The architecture is more flexible in that, changes to the server can be made without forcing users to download patches or revisions.
* Protect client privacy by acting on their behalf (client IP is only known by the server)
* Deferred messaging and other miscellaneous features. If a user A wishes to message user B, who is offline, the server can take a message. When user B does finally come online, the server can relay the message to him or her.
I did not employ these features, but adding them would certainly be an easy task. I will post the code, once I get a chance to clean it up a little (dirty me!).
Port Chat Application to Web
Porting the application to the web should seem like an easy task. Convert it to an applet, and let it communicate to the server from there.
It would have been far easier if it weren’t for Java’s Sandbox security model (a good thing). Hence the applet, under normal circumstances, can only communicate over the HTTP port. This means that the server would need to be replaced by a servlet acting as a server. This last stage, is what remains to be done and for the moment, I do not intend to get back to the project anytime soon. Reason being that I would rather start over with a fresh design and explore java RMI.