Ask Computer Network & Security Expert

Question 1: Add code to the class: MyClient in example 3 of lecture 1 to impose a timeout of 5 seconds. If a timeout does occur, a message "timed out on receiver" should be displayed and the client should be terminated.

Hints:

1. You need to call the java method: setSoTimeout(5000) of class: DatagramSocket.

2. You need an extra catch-block with the exception class: SocketTimeoutException.

Question 2: In a client-serve program we normally run the server first and then the client. If we run the client first we get error message. We like to run the client first and then the server. Change the class: MyClient in example 1 of lecture 2 (which is on sockets) to avoid any exception error. In other words as long as the server is not connected the client stays on with no error.

Note: Only copy/paste the class: MyClient under the word: Answer.

Hints: The client has to loop around until the server gets connect. You may need to include more try-catch block(s) or/and more specific exception class(s). Run the client many times to make sure you do not get any type of exception errors.

Question 3 Using RMI, write an application for a prototype opinion poll system. Assume that only one issue is being polled. Respondents may choose yes, or no. Write a client-server application to accept the votes, keep the tally (in memory), and provide the current counts to those who are interested.

Note: Fill the following classes. Do not change the name of the classes and the interface. Copy/paste your answer under the word: Answer.

Note: This question is a shorten version of exercise: 9 on page 230 of your book.

Note: You do not need to make a number of client programs. Make one server and one client programs. Keep the server running and run the client several times. For example I run the client three times as follows. Note that this is just a sample example. Your answer must work for any number of clients:

Enter port: What is your vote?[yes|no] : yes

Yes = 1; No = 0

Enter port: What is your vote?[yes|no] : no

Yes = 1; No = 1

Enter port: What is your vote?[yes|no] : no

Yes = 1; No = 2

Server Side:

import java.rmi.*;

import java.rmi.server.*;

import java.rmi.registry.Registry;

import java.rmi.registry.LocateRegistry;

import java.net.*;

public class Chapter7Problem9Server{

public static void main(String args[]){

}

}

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.*;

import java.rmi.server.*;

public class VoteServerImpl extends UnicastRemoteObject implements VoteServerInterface {

}

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.Remote;

public interface VoteServerInterface extends Remote {

public String castVote(char vote )throws java.rmi.RemoteException;

}

Client Side:

import java.rmi.*;

import java.util.*;

public class Chapter7Problem9Client{

public static void main(String args[]){

}
}
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

import java.rmi.Remote;

public interface VoteServerInterface extends Remote {

public String castVote(char vote )throws java.rmi.RemoteException;
}

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M91335514
  • Price:- $65

Guranteed 36 Hours Delivery, In Price:- $65

Have any Question?


Related Questions in Computer Network & Security

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. AND PROVIDE CITATION IN APA 1. Describe the differences between bus, ring, star and mesh topologies. 2. Explain the TCP/IP Model ...

The abstract should not be more than 250 words describe

The abstract should not be more than 250 words. Describe your project, focusing on research questions and research method for next stage of the project. 1. Introduction [The introduction should describe what the project ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As