Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Applied Distributed Systems Assignment: Java UDP Client Server Application

Objectives

This assessment item is designed to test your understanding in Java UDP networking, file reading and writing using client/server application development.

Task

Your task for this assignment is, to design and implement UDP (User Datagram Protocol) API Socket in a client/server model. In java Datagram Socket uses connectionless protocol with basic send and receive methods. This assignment is built on the learning outcomes from the supplied code for UDPClient and UDPServer from week2 lecture and tutorial materials.

The UDPClient can send offline text messages to the UDP server and because this protocol is not reliable the server should acknowledge the sender that it has received the message. Multiple clients should be able to send messages to the server and no threading is required on the server. The server waits constantly receiving and acknowledging the clients for the messages it receives. When a message is received by the server the IP address of the client socket is used to determine the client's location. However multiple clients can also connect from same location when all the clients and the server are running locally on the same machine. So we distinguish each of them by a location which the user needs to enter before the interaction can start with the server. The client should only be able to transmit messages after entering a valid location. A valid name can be any alphanumeric but cannot be empty. The UDPClient should be able to continuously chat to the UDPServer. The server should store all the messages received in to an ArrayList and a timer should be set up to write contents of the ArrayList to a file.

The timer Schedule can be implemented in java as follows:

eg) class WriteToFile extends TimeTask and overrides run() method to do the file writing. Timer tm=new Timer();
tm.schedule(new WriteToFile(),long delay, long period);

java inbuilt Collections.sort() can be used to sort the ArrayList before writing to the file. Since the contents of the input and output file is in text format, Java IO classes Scanner and PrintWriter can be used for simplicity.

Case Study

The Hills School is a leading private educational institution providing primary school education for children across three major cities (Melbourne, Sydney and Brisbane) in Australia. Currently each school maintains a manual log book which each parent/guardian need to sign in and sign off when they drop and pick up their children from school. The school would like to have a centralised system to keep track of this process electronically. When a child is enrolled the school registers a mobile number and a pin which the parent need to use to sign in and sign off. A Kiosk will be set up to run the UDPClient. When the kiosk is powered up in the morning, the school location need to be entered. However in reality this is not required because when the server receives a message from the kiosk the client socket address is used to determine the location. For simplicity and testing since multiple clients can run locally, we are required to enter the location when the client starts and this cannot be empty. The server should persist the client sign in and sign off details to a log file and also display this information on the server side screen.

Part 1 Design: Java UDP Networking, and writing to a text file

A simple GUI (Graphical User Interface) java application needs to be developed for UDPClient and UDPServer.

A JOptionPane can be used to get the location at the start of the Client application and this cannot be empty. A better way is to use a dropdown box for location as in sample screens provided, this eliminated data entry errors.

The message to be transmitted consists of mobile number, pin and reason (Sign In/Sign Out). The message fields need to be separated by a colon ":" before dispatching to the server, this is not entered by the user. No information need to be stored on the client side and all validations need to be done on the server side.

Client sends to UDP Server a message consisting of: Location: Mobile Number: Pin: Reason: Time

UDPServer stamps this message with the IP address from the received client and adds this to an ArrayList :

Location: Mobile Number: Pin: Reason: Time: IP address of the client socket

The server should initially load from an existing text file with a list of phone numbers and pin's which the admin staff always keep up to date. You can implement this in two parallel String arrays containing mobile numbers and pin's or use two separate Array Lists. This text file with phone numbers and pin numbers will be provided.

Also Java provides String. Split (":") to break up the incoming sentence in to an array of Strings

On the client side after the message is sent a Status with single ("*") and when acknowledged by the server should be shown as ("**") along with any error message if the phone number and pin's do not match up with the server's list. Possible states include ("Success", "Invalid number", "Invalid Pin"). The server first validates phone number before proceeding to validate the pin number.

Every 2 seconds the server should sort the list on the school location and over writes the entire list to a file User should have an option to clear the Array List on the server.

Part 2: Program use and test instruction

After the implementing the framework, prepare an end user instruction manual about how to use your software along with a brief description where this technology can be used and what happens to the messages if the server is dead or not running.

Attachment:- Assignment-Java-UDP-Client-Server-Application.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92765275

Have any Question?


Related Questions in Java

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

  • 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