The submission for Multifinger lab is over, the following people have submmitted. Here is the old sample program for your reference, a more elegant one is here. For those of you who do not know how to use ref counted objects and rely on global variables to keep track of per connection state, you may learn some interesting stuff from this program.
The tar file 6894-0.1.tar.gz distributed previously only allows maximum 5 arguments to the callbacks. Since we mentioned in our documentation that callbacks have default maximum 7 arguments restriction, you can download the new tar file if you need more than 5 arguments for your callbacks. Otherwise, the old tar file works just fine. :-)
The first programming project in 6.894 is meant to introduce you to some programming tools you'll be using for the rest of the course, particularly the C++ asynchronous programming library. You'll download source to the library and to the multifinger demonstration program, make a small modification to multifinger, test your code, and submit it to the 6.894 staff.
% add -f gnu (only on Athena) % gzcat < 6894-0.1.tar.gz | tar xf - % cd 6894-0.1 % ./configure % makeClick here if you run out of disk quota while compiling. For your purposes the result of all this is the executable multifinger/multifinger, which is described in Using TCP Through Sockets. Here's how to test it:
% multifinger/multifinger firstname.lastname@example.org email@example.comThis should produce information for Robert Morris and Frans Kaashoek, though perhaps not in that order.
% multifinger/multifinger firstname.lastname@example.orgThe problem is that while frenulum accepts finger requests, it never produces any responses.
Your assignment is to modify multifinger/multifinger.C to terminate connections that don't finish producing a response within 10 seconds of the connection setup. That is, after connect_cb is called, your multifinger should spend no more than 10 seconds waiting for the write()s and read()s to complete. If 10 seconds pass without a complete answer from the server, close the file descriptor and move on to another command-line argument. For example, when your multifinger is run thus:
% multifinger/multifinger email@example.com firstname.lastname@example.org should quickly print the information for Max Poletto, then wait 10 seconds, then exit.
You'll want to use the delaycb function mentioned in Section 5.3 of Using TCP Through Sockets.
% limit descriptors 64 % perl ./test-mf.plIf the limit command doesn't work, try limit openfiles 64 or ulimit -n 64 instead. If all goes well, test-mf.pl should finish in about 40 seconds and print out
Finger one user: passed Finger two users: passed Time out a stuck host in 10 seconds: passed Combination of good and stuck hosts: passed More than 64 hosts: passed Lots of good and stuck hosts: passedWe'll also test your program with test-mf.pl, and perhaps other tests.
% Mail -s '6.894 lab 1' email@example.com < multifinger.C
We must be able to compile your software with our standard async library, so don't modify the async library. We will compile your source in the same kind of sub-directory as multifinger, so that (for example) the async library source and header files will be in ../async. If you have any problems about submission, please contact firstname.lastname@example.org. The lab is due by the beginning of class on Thursday, September 14th.