ass2 of IP


Published on


  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

ass2 of IP

  1. 1. COMP9031 INTERNET PROGRAMMING ASSIGNMENT 2 Theme: RMI Programming in Chat Server Application Released: Tuesday 25 Aug 2009 Due: Friday 11 Sept 2009 (11:59PM) Marks 15 Please download Code-for-Ass2 (on the homepage), compile, and prepare it to run. [Let us refer to this running system as RMI-Chat-Server(RCS).] Part 1(2 marks) Run the RCS system and prepare a report (Report.pdf) answering the following questions. Please copy the questions in your report, and write the answers below each question (as shown for example in question 1 below). RMI 1. What are the RMI operations provided at the server side? What are the RMI operations provided at the client side? Ans: [Provide your answer here] 2. Why do we have to run the rmic command? 3. Why we do we need to run the rmi daemon ? 4. Are there any good reasons why the server side object is Activatable where as the client side object is UnicastRemoteObject? 5. What is the use of the register (...) method in the class ChatServerImpl ? Is this method really necessary in the current implementation code? 6. rmiregistry: a. What errors do you get when you don’t run the rmiregistry before you run your chat server? Explain what has happened. b. What happens when you abort the registry in the middle of a chat session? Explain what has happened. 7. Why do we need to specify polices? Explain what is specified in each policy file. 8. What is the need for the http server? RMI-Chat-Server(RCS) 1. Why do we have to have two Remote interfaces at the server? 2. Suggest some more interfaces at the server that you think will be useful for a chat server application. 3. Explain how the server gets the reference to the remote client object. 4. In the method registerclient(...), why do we need to synchronize the add(client) operation? HTTP Server Explain the error messages (if any) 1. When the http server is turned off even before the chat server is started. 2. When the http server is aborted in the middle of a chat session. Client 1. Explain how the client obtains the reference to the server’s remote object.
  2. 2. Part 2 (5+3 marks) Server GUI(5 marks) Build a GUI at the server side, and provide the following buttons: 1. ST button: Start the server and display the message Server started. 2. SP button: Stop the server and display the message Server stopped. 3. ON button: Turn the moderator ON and display the message Moderator turned ON. 4. OFF button: Turn the moderator OFF and display the message Moderator turned OFF. 5. EX button: Stop the server, if it is running currently, and close the GUI window. No message displayed. The server GUI will also display the warning messages sent to the users as shown below. The server GUI looks like the client GUI, except that it has more buttons. Moderation policy: Assume keywords = {let,us,meet,tomorrow}. 1. Any message that contains all the key words above in any order will be blocked and a warning Your messsage contains all key words will be sent to the sender of the message. 2. Any user who has been warned more than twice will be removed from the chat server. The moderator implements the policies above. Server GUI with sample messages displayed.
  3. 3. Client GUI (3 marks) Client GUI already has some buttons. Provide the following buttons additionally. 1. Enter Information Button: When this button is clicked, you must collect the following details and send them to the server to save: name of the user, address, and phone number. 2. Get Information Button: When this button is clicked, ask for the name of any user, search for his details (name, address, and phone number) at the server, retrieve them, send them to the client, and display them at the client GUI. Part 3: Extension [5 marks] (If you score, say k marks, in this section, then the remaining 5 – k marks will be added to your Final Exam weight (which is currently 40%)) Currently the clients call the method registerClient( ChatClient client ) and pass on a ChatClient object to the server, which the server uses to send messages later. We want to redefine registerClient( ChatClient client ) as registerClient( String clientName ) so the clients can pass on their names (as strings), rather than their objects. Modify the chat server and the client programs incorporating this change. Submission Prepare a readme.text file containing commands and instructions that tell the tutor how to run your program. Submission command: % give cs9031 ass2 program.jar Report.pdf Readme.text Deadline: Friday, 11 Sept 2009. We accept both Windows and Linux versions.