This informational handout covers introductory material describing the Fishnet software that you use, the Fishnet programs that you write, the development environment, and testing strategies.
The term "Fishnet" is somewhat overloaded, and before going further we want to clarify what it means. First, it is the code that makes up all of the assignments. This is the Fishnet development environment. Second, it is a running network of many nodes. This is what we most commonly mean by Fishnet. Note, however, that there are many potential running Fishnet networks. You will all start your own, private, fishnet as a managed overlay controlled by a single fishhead (a key component to be described shortly) to develop and test the code required for assignments. It will run as cluster of processes on one or more PCs. In this form your nodes will not interact with nodes of other students' networks. There is also The Fishnet, with a capital “T”. This is the one, shared network that everyone's node is able to join and participate in a collective class network. This is accomplished simply by pointing your code at a public fishhead server that we run.
As you develop your Fishnet node and test it, one of the first things it will do is to join a private fishnet network by contacting the fishhead. This means that before you start one of your Fishnet nodes there must be a fishhead process running. You only need to start a fishhead for your network once, even though the nodes in the network can come and go. Type ./fishhead -h to get usage information.
fish_send()function, for example, libfish.a is called to do the work of sending the packet. libfish.a also prints a large (but controllable by using
fish_setdebuglevel()) amount of debugging information to help you understand what is going on with your program.
% cd $HOME % cp ../public/cs123b.tar . % tar xvf cs123b.tar % make hello Pick a random port between 1024 and 65535, say 4173 % ./fishhead -p 4173
Note: do not kill the fishhead (do not hit CTRL-C).
Now start a new shell. If you are using X window (i.e. your are in the lab), you can start a new terminal window. If you are remotely logged in, you can start antoher remote login connection to get new shell.
% ./hello [hostname]:4173 105This creates a node with address 105. If it is not running, make sure your fishhead is running at the same port (Did you kill fishhead by hitting CTRL-C or closing the window?).
Now start another new shell and run another hello node with address 33.
% ./hello [hostname]:4173 33 This creates another node with address 33, now you can try to say hello to each other by input these command to these nodes hi 105 hi 33
fish_send(). These are Fishnet API calls. All of these calls are explained and documented with comments in fish.h. The documentation includes comments for the structures representing packets that are passed to and from. You won't find this information anywhere else.
main()to initialize and then enter the main event loop. Initializing involves joining the fishnet with
fish_joinnetwork()and setting up functions to be called on specific events, e.g., a
on_receive()function to be called when there is keyboard input. Entering the main event loop is done by calling
fish_main(), a call that never returns and from which the program is terminated directly when "exit" is typed at the keyboard. Events such as packet reception are handled as "upcalls" from the main loop.
Here are some other points you should note before start coding:
man -s 3c <function>to get more help.
fish_main(). You can use debugging messages to check if this program has worked, as you will get messages when you have joined. Next, you might try for keyboard input, and print it out but not send a packet yet, and so forth. While this strategy might seem like overkill at this stage, you should get used to it before attempting the larger assignments, and particularly when you find that something is not working properly. The beauty of testing functions is that the problems are rarely where you think they are and testing is the only way to pin them down. Despite this strategy, more difficult bugs will require you to use the debugger, gdb.
fish_setdebuglevel()function, you will see libfish debugging messages that show how your packets move through the network. Also, note that there are Fishnet API functions for logging debugging output to a file for later inspection.
Congradulations! Since you hit here so far, you are certainly ready for the first assignment.
April 24, 2003
UCSD CSE123b Communications Software