Node Net



Third Laboratory: Systems of Objects; Nodes and Channels

Node net is designed to develop testing and debugging skills. Students also get practice implementing an interface and handling exceptions. The node net program allows the students to build networks out of nodes and channels. By default three types of nodes are available: generator nodes, intermediate nodes, and terminator nodes. Nodes are connected by channels. Generator nodes create "packets" and send them out to channels, intermediate nodes read "packets" from channels and retransmit them, and terminator nodes consume "packets." The students write their own class(s) implementing the NodeBehavior interface, and load it into the program, usually for use as an type of intermediate node.

Running the Program

There are many ways to run the code in class. You should choose the one that your students are ready for. They are presented in an order that represents an increasing usage of the command line utilities and options.

1.)a) Click here
   b) File > Expand Classpath > (choose jar/dir of package of student code.)   
   c) File > Load Behavior > (enter fully qualified Class name for student code)

      (requires Java WebStart). If you want to put a link on your course 
      web site, you may use a link like this (subject to our terms of use 
      like all materials on the site): 

      <a href="http://www.cs101.org/psets/ballworld/demo/ballworld.jnlp">Click Here</a>

2. a) java -jar nodenet.jar
   b) File > Expand Classpath > (choose jar/dir of package of student code.)   
   c) File > Load Behavior > (enter fully qualified Class name for student code)

3. a) java -cp nodenet.jar nodenet.Main
   b) File > Expand Classpath > (choose jar/dir of package of student code.)
   c) File > Load Behavior > (enter fully qualified Class name for student code)

4. a) java -cp "nodenet.jar:/path/to/student/code" nodenet.Main
   b) File > Load Behavior > (enter fully qualified Class name for student code)

5. a) java -cp "nodenet.jar:/path/to/student/code" nodenet.Main stupkg.StudentBehavior [stupkg.StudentBehavior2]

6. a) jar -xvf nodenet.jar
   b) java nodenet.Main
   c) File > Expand Classpath > (choose jar/dir of package of student code.)
   d) File > Load Behavior > (enter fully qualified Class name for student code)

7 thru 9 same permutations on the unpacked executable jar.

10 - 13 again but start with the source jar, add compilation step(s).

(Line 6b assumes that you have the current directory on your default class path)

Usage Notes

Screen Shots

The screenshot below shows the program run with method 1 above, and a user loaded node behavior named Foo. Channels turn red when they are full to capacity. The channel on the right that has turned red has been configured to a capacity of 3 and a latency of 5000 miliseconds causing a traffic jam.

screen shot of the nodenet program

Packets are probably not being lost in this simulation despite the fact that 9 packets on the display and plus 89 at the terminator don't add up to 100 (matching the sum of the generators). There is definately one packet waiting to be transmitted in the upper right Intermediate node, and any one of the other intermediate nodes or the foo node might hold the last packet. To be sure that packets are not being held temporarily by student node behavior code one should disable all generators and let the simulation run until it seems to reach a steady state as shown below. Only after letting the network run without active generators can one be sure that a network is or is not dropping packets.

second screen shot of the nodenet program

This page is a part of Lynn Andrea Stein's Rethinking CS101 project, part of the Computers and Cognition Group at the Franklin W. Olin College of Engineering.
This material is based upon work supported by the National Science Foundation under Grant No. EIA-0196404. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation
Valid HTML 4.01!
Valid CSS!
cs101-webmaster@olin.edu
Last modified: Monday, December 5 2005 at 5:19 AM EST