Due date: Sunday April 4, 11:59pm (that's 60s before midnight)
Delivery: Tar and gzip your files (java source code, Makefile, etc) and send your files to ta-51024@cs.uchicago.edu. Include "CSPP51024 A1" in the subject line.
Grading:
Pass/Fail. A failure deducts 2 points from the potential number of points you can get for Milestone 1. That is to say, it makes the total points available for Milestone 1 8 points instead of 10. A pass keeps the Milestone 1 points available at 10.
Part 1: Write a finger client as a Java application.
How does the finger client work?It opens a socket connection to foo.bar.com using the finger port (well-known port: 79), and sends the username to the finger daemon running on the host, then reads back and prints out whatever finger information is available.Details:Additional requirements (please keep in mind that both are hard requirements):Additional info:You would call your finger client from the command line in one of these variants:
- your class has to be part of the package: edu.cspp51024.your_user_name
- provide a Makefile to compile your code
java edu.cspp51024.your_user_name.Finger user@foo.bar.comAnd it should print out whatever the finger server on foo.bar.com returns. Like this:java edu.cspp51024.your_user_name.Finger @foo.bar.com
java edu.cspp51024.your_user_name.Finger user
[2:08pm] matei@buda:SocketsExample 63% java myFinger matei@buda.cs.uchicago.edu
[buda.cs.uchicago.edu]
Login: matei Name: Matei Ripeanu
Directory: /home/matei Shell: /usr/bin/tcsh
Office: Ry403, 555-1212
On since Mon Mar 26 18:40 (CST) on pts/0 from :0.0
1 day 23 hours idle
On since Mon Mar 26 18:44 (CST) on pts/1 from :0.0
1 day 16 hours idle
On since Mon Mar 26 18:53 (CST) on pts/2 from :0.0
1 day 16 hours idle
On since Mon Mar 26 18:57 (CST) on pts/3 from :0.0
4 days 19 hours idle
On since Thu Mar 29 19:38 (CST) on pts/4 from :0.0
1 day 16 hours idle
On since Thu Mar 29 21:46 (CST) on pts/5 from :0.0
1 day 15 hours idle
On since Thu Mar 29 21:46 (CST) on pts/6 from :0.0
1 day 16 hours idle
On since Sat Mar 31 13:56 (CST) on pts/7 from nsit-s227-147.uchicago.edu
New mail received Sat Mar 31 14:20 2002 (CST)
Unread since Sat Mar 31 14:17 2002 (CST)
No Plan.Finger RFC: ftp://ftp.isi.edu/in-notes/rfc1288.txtYou might want to use the StringTokenizer class to split the address supplied as a command line argument into a username and an address.
Part 2: RMI based calculator
Implement a simple calculator using RMI. Since RMI is about communication between distributed objects, you'll need to implement a server and a client. The server should know how to add, subtract, multiply and divide two numbers. The client will get two numbers and an operator (specified through a character: '+', '-', '*', or '/') as command line arguments, send them to the server, and print the result returned by server. (Note: to pass '*' as a command line argument you might need to use quotes to prevent the shell to use it for filename substitution.)
Additional requirements (please keep in mind these are hard requirements):
- your classes have to be part of the package: edu.cspp51024.your_user_name
- provide a Makefile to compile your code
- your calculator should implement the following interface:
import java.rmi.*; import java.util.*; public interface CalculatorServer extends Remote { public int compute(int op1, int o2, String operation) throws java.rmi.RemoteException; }