Generic class to facilate use of callbacks
Also provides a static helper function to get an object of Method that can be passed to the constructor of this class
Example:
To get a Method object for the method public foo(String str) in class Test:
String[] paramTypes = {"java.lang.String"};
Method method = Callback.getMethod("foo", this, paramTypes);
Callback cb = new Callback(method, this, "fooTest");
The above code snippet assumes that it is written inside class Test, hence the use of this.
Keeps track of information about an emulated node
Emulated node uses a TCP socket to talk to the Trawler, but send and receive messages directly
to other emulated nodes using UDP.
Node -- Class defining the data structures and code for the
protocol stack for a node participating in the fishnet
This code is under student control; we provide a baseline
"hello world" example just to show how it interfaces with the FishNet classes.
Wait for a node to connect, then:
find out if any nodes have left while we were waiting
(and if so, update their neighbors so they stop sending them packets)
find a free fishnet Address to assign to the new node, and send it to them
(by writing to the node's TCP socket)
find out which UDP port they are listening to
(by reading from the node's TCP socket)
tell the node about all its neighbors' IP addresses and port #'s
tell all their neighbors with their IP address and port #
loop