Code Walkthrough TalkIn November 2006 I gave the second talk of the evening at the Java SIG of SDForum. It was essentially a walkthrough of some of my open source applications, and a discussion with the audience about the design and code and how they could be improved. One of those applications was QuickQuiz, and one of the suggestions I got was to take a look at JGroups for the networking layer. I sort of filed that suggestion away until a couple weeks ago when I started looking at improving QuickQuiz again.
QuickQuiz Components
QuickQuiz 1.3.3 consists of three parts:
- a quiz giver Java Swing client, for the teacher or other person giving a quiz
- a quiz taker Swing client, an instance of which is run by each person taking the quiz
- a server to coordinate all the traffic and the quizzes
UDP Multicast
UDP multicast is a very efficient way for a network node to simultaneously send a message to multiple receivers. Receivers register their interest in a particular stream of information by telling a router or switch that they want to join that stream's multicast group. The router or switch from then on propagates all such packets to the receiver.
Multicast in QuickQuiz 1.4.0
I just modified QuickQuiz 1.4.0 to use UDP multicast instead of RMI. Indirectly.
Java has nice features, such as java.net.MulticastSocket, for multicasting UDP packets, but there's a simpler, more powerful and flexible way: JGroups. From its Web site: "JGroups is a toolkit for reliable multicast communication."
Need for Protocol Independence
UDP multicast is very efficient, and works nicely when all the participants are on the same local area network (LAN). On a wide area network (WAN), and with some participants behind firewalls, it doesn't work. TCP and a separate server to coordinate the traffic better serves this case.
JGroups lets you write your code to be completely independent of the network protocol stack. So when everybody's on the LAN you can tell JGroups to use UDP multicast at the bottom of the stack. And when some parties are behind a firewall over a WAN, with a simple configuration change you can have a tunneling TCP protocol at the bottom. It's the ultimate in flexibility.
Students Love Result
My students played with the new QuickQuiz Monday, and I was very proud when I saw their chat messages arriving on their neighbors' computers before their little fingers had bounced off their Enter keys.
Here is a short demo video of QuickQuiz. Do help me spread the word about this free program for teachers and students. In the future I'll write about QuickQuiz integration into Moodle.
1 comments:
hey dave,
JGroups is a great tool , It provides the foundation for JBoss clustering.
sudhish
Post a Comment