Develop a java application for udpclient and udpserver

Assignment Help JAVA Programming
Reference no: EM131926616

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

Reference no: EM131926616

Questions Cloud

What privacy issues might be a concern with bank records : ow do you plan to acquire the data? What privacy issues might be a concern with bank records (bank account numbers, customer names, etc.)?
Compute what is the payout and the profit : You write an IBM July put contract at $120 for premium of $4. You hold the option until expiration when share price is $121. What is the payout and the profit?
Calculate the interest payment after the second 6 month : Calculate the interest payment after the second 6 month period. Show the equation with numbers to find the unknown semi-annual yield on the security.
Find the weighted average cost of capital : Pablos's store has two loans, one for $125,000 at 8% and the other is $300,000 at 8.5%. His equity investor put in $500,000 and expects a 12% return.
Develop a java application for udpclient and udpserver : Develop a java application needs for UDPClient and UDPServer. A JOptionPane can be used to get the location at the start of the Client application.
The covariance between the returns on stocks a and b : The standard deviation of the market index is 27%; the residual standard deviation of the error terms for stock A is 22%;
What is the value of sgp to raymond : Raymond Supply, a national hardware chain, is considering purchasing a smaller chain, Strauss & Glazer Parts (SGP). Raymond's analysts project that the merger.
Calculate the operating cash flows associated : Calculate the operating cash flows associated with the new lathe. (Note: Be sure to consider he depreciation in year 6.)
Calculate the company net profit margin : Williams Oil Company had a return on stockholders' equity of 18 percent during 2013. Its total asset turnover was 1.0 times, and its equity multiplier.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Ask the user to enter a positive non-zero integer value.

Write a program which aske the user to Enter a positve non-zero integer value. if the value enterd zero or negative print as error message and end the program; otherwise, use the integer to call a method displayPattern(n) which must display the follo..

  Java program that implements an algorithm known as a bubble

writing a simple Java program that implements an algorithm known as a Bubble Sort. A Bubble Sort is a simple sorting algorithm that takes an unsorted array of elements and sorts them into ascending order.

  Display the list of what was purchased

Create a shopping list - Present the items back to the user and have the user determine the order of importance for the item to purchase.

  Write a program to implement an appointment book

Write a program to implement an appointment book. Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly.

  Write a method, insertat that takes four parameters

Write a method, insertAt that takes four parameters

  Productexception class whose constructor

Create a ProductException class whose constructor receives a String that consists of a product number and price. Save the file as ProductException.java. Create a Product class with two fields, productNum and price. The Product constructor requires va..

  Method summarizesequences that takes a string as a parameter

Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above

  Find the greatest common divisor between two inputed integer

I have to write an interactive program that will find the Greatest common divisor between two inputted integers.

  Write the methods displaymenu and soundspeed

Write the method DisplayMenu and SoundSpeed- Make sure that distance is a positive number.

  Modify the numbers guessing game program

Modify the numbers guessing game program. Suppose that the variable num and guess are as declared and the diff is an int variable.

  Write a java application that calculates and displays

The application should ask the user to enter the name of the property owner and the assessed value of the property for each owner (total N owners) and calculate the property tax.

  Create your own simple java application

Create your own simple Java application to generate X random Integer values between 0 and Y. Use command line arguments for entry of X and Y

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