Skip to content

ChatLand is an IRC server written in Java. This was a homework assignment for Dr. Youmin Lu, Fall 2010.

License

Notifications You must be signed in to change notification settings

ultasun/chatland

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatland

ChatLand is an Internet Relay Chat server written in Java. This was a homework assignment completed as part of the Advanced Java course at Bloomsburg University for Dr. Youmin Lu, as a student, in Fall of 2010.

Criteria for the assignment was to write a thread-safe, stateful multi-user system to utilize sockets. The server utilizes intrinsic locks and guarded blocks (i.e., Object.wait() and Object.notifyAll()) to achieve CPU-efficient concurrency. The author personally selected IRC as a theme for this assignment.

RFC 1459

This server partially implements RFC 1459. The majority of the protocol is not implemented, but enough is implemented to support very primitive chat use.

The server has been tested with irssi and XChat.

Installing

The easiest way to run ChatLand is to build and run it within NetBeans.

  1. Clone this repository,
  2. Open the project in NetBeans,
  3. Run the project!

ChatLand is alpha quality software, it was a homework assignment. Some issues are recorded in the repository's issue tracker.

As of now there is no serious intention to deliver an executable for general purpose use.

Threads Explanation

There are 2 + (userCount * 2) threads running at any given time.

  1. The first thread, Main, loops forever and is blocked by ServerSocket.accept().
  2. The second thread, IRCWorker, loops forever and is blocked until input from a client (which is a third, fifth, or higher thread) invokes notifyAll(), thus indicating a Message is available to be processed.
  3. The third (or any odd numbered thereafter) thread, ClientInput, receives textual input from a remote IRC client, and is blocked by Scanner.nextLine().
  4. The fourth (or any even numbered thereafter) thread, ClientOutput, sends textual output to remote IRC client, and is blocked while waiting for the IRCWorker thread to insert a Message into the output queue.

Explanation Notes

  • Each connected client has its own IRCHandler.
    • The IRCHandler may be thought of as the bridge between the two dedicated client threads (ClientInput, ClientOutput), and the Message processing IRCWorker thread.
  • There is one worker thread (IRCWorker) to update the state of the IRC server as it processes the Message objects from the client queues.
    • After significant adjustment, it would be possible to have multiple IRCWorker threads to increase throughput.
  • The server does not utilize any thread pools.

Credits

This project is the sole work of the author ultasun. Please see the LICENSE. Thank you for reading!

About

ChatLand is an IRC server written in Java. This was a homework assignment for Dr. Youmin Lu, Fall 2010.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages