Assignment on client-server program

Assignment Help Computer Networking
Reference no: EM13765744

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;
}

Reference no: EM13765744

Questions Cloud

Police website - what is there and how it is helpful : in APA style article about Police Website what is there and how it is helpful and what u found there the site the website
Are ethical rules relative guidelines or universal laws : Throughout history ethical systems have been articulated that outright contradict each other-are ethical rules relative (guidelines) or universal (laws)?
Discuss the emerging issues and trends : Identify and discuss the emerging issues and trends surrounding the reasons for why the topic was included in the Affordable Care Act (PPACA)
Marketing plan for the launch of new mobile phone : Now that Michelle has all of the pieces of her marketing plan in place, the board is ready to see the final plan.
Assignment on client-server program : Add code to the class: MyClient 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.
Construct a substantive response using minimum of two source : Discuss two major differences between a traditional hazard such as the 2007 California Wildfires and the terrorist-related hazards associated with the Aum Shinrikyo Sarin Gas attack on the Tokyo Subway that occurred in March of 1995
Categories of hazards associated with terrorism : Based on your knowledge, experiences, and the weekly readings, analyze two of the five major categories of hazards associated with terrorism
Write an argument for or against the law : The February 2012 shooting of Treyvon Martin in Florida raised question about stand -your-ground laws everywhere. Write an argument for or against the law. Support your argument with data
What items would you ask to take from the home : You are asked to investigate the case of a missing girl. Her parents are not sure what happened to her. It is possible thatshe ran away from home, but she may have been kidnapped. What items would you ask to take from the home

Reviews

Write a Review

Computer Networking Questions & Answers

  Rewrite the ip addresses using binary notation

Rewrite the following IP addresses using binary notation- 12.74.16.18/22

  Take a moment and think about how technology influences

1 suppose you decided to create an online dating profile. what information about yourself would you be willing to

  Deliver a research paper and presentation based on your

deliver a research paper and presentation based on your research.future threats to network security and planning for

  Question 1aregister the owasp top 10 web application

question 1aregister the owasp top 10 web application security risks for 2010.bwhy does software have to be intensively

  Explain current standards and policies with star clothing

In context of telecommunications standards and policy, create 3-5 page white paper which explains current standards and policies which are suitable to MCG's work with Star Clothing.

  Program to accept bit string and generates unipolar encoding

Write program to accept a bit string and generates the unipolar, NRZ and Manchester encodings for the bit string. You can use any programming language/platform and generate the output in any appropriate manner.

  Give your opinion on whether or not the argument that

value please respond to the followingbullassess bcp as a process that adds business value. give your opinion on whether

  Mpls over ip solution or form of long-haul ethernet

What occurs if office in Baton Rouge, Louisiana, also should be connected to both Memphis and Laramie at a rate of 512 kbps? Which solution is cheaper now?

  Part 1 of 1 - 1 question 1 of 16let npq where pq are primes

part 1 of 1 - 1 question 1 of 16let npq where pq are primes of the same length and let phi be eulers totient

  Write four addresses broadcast and network number

How many networks will be available? Write down the four addresses (broadcast and network number) for network starting at 131.204.18?

  Create an in-house private social network and then use it

1 are companies that introduce a significant change in their industries thus causing a disruption in normal business

  Describe what 3g and 4g are regarding wireless standards

Describe what 3G and 4G are regarding wireless cellular standards. What are the major differences between the two generations?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd