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

  Networking and types of networking

This assignment explains the networking features, different kinds of networks and also how they are arranged.

  National and Global economic environment and ICICI Bank

While working in an economy, it has a separate identity but cannot operate insolently.

  Ssh or openssh server services

Write about SSH or OpenSSH server services discussion questions

  Network simulation

Network simulation on Hierarchical Network Rerouting against wormhole attacks

  Small internet works

Prepare a network simulation

  Solidify the concepts of client/server computing

One-way to solidify the concepts of client/server computing and interprocess communication is to develop the requirements for a computer game which plays "Rock, Paper, Scissors" using these techniques.

  Identify the various costs associated with the deployment

Identify the various costs associated with the deployment, operation and maintenance of a mobile-access system. Identify the benefits to the various categories of user, arising from the addition of a mobile-access facility.

  Describe how the modern view of customer service

Describe how the greater reach of telecommunication networks today affects the security of resources which an organisation provides for its employees and customers.

  Technology in improving the relationship building process

Discuss the role of Technology in improving the relationship building process Do you think that the setting of a PR department may be helpful for the ISP provider? Why?

  Remote access networks and vpns

safekeeping posture of enterprise (venture) wired and wireless LANs (WLANs), steps listed in OWASP, Securing User Services, IPV4 ip address, IPV6 address format, V4 address, VPN, Deploying Voice over IP, Remote Management of Applications and Ser..

  Dns

problems of IPV, DNS server software, TCP SYN attack, Ping of Death, Land attack, Teardrop attack, Smurf attack, Fraggle attack

  Outline the difference between an intranet and an extranet

Outline the difference between an intranet and an extranet A programmer is trying to produce an applet with the display shown in Figure 1 below such that whenever one of the checkboxes is selected the label changes to indicate correctly what has..

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