Java advance 4

profilewilden
project_details.docx

Scope Of the Project

With networks, a single program can retrieve information stored in millions of computers located anywhere in the world. A single program can communicate with tens of millions of people. A single program can harness the power of many computers to work on one problem.

Application

In this application you first run the class AppServer.java with starts your server and shows Server started message in the console. Then you start CustomerApplet.java which shows you a GUI.

Output in Console: Server /started

Then we enter the customer name and then press Connect. Then data connection is established and data is send to the servers where they are stored in 2 files:

1)Customer.txt

2)Product.txt

Then the customer name is saved in Customer.txt and product name in Product.txt

Then we grant read only access and then if we again try to give customer name and product name and connect, it would show the message sent in console along with an error message that Access Denied. We need to again rename file or delete the 2 formed files so that we can again save the names in their respective files.

Output in Server Console

Server /started

Received Name: Wilden

Received Product: McLaren

Then we select Customer Info and Product Info and get the following screens as output:

These are obtained by reading Customer.txt and Product.txt in which on connection, details were saved.

Now if we again try to give a new Customer name and Product name, the console shows the following:

Console at Server Side:

Server /started

Received Name: Wilden

Received Product: Mclaren

Read Only operation is permitted to: D:\Customer.txt: true

Read Only operation is permitted to: D:\Product.txt: true

D:\Customer.txt (Access is denied)

D:\Product.txt (Access is denied)

This is because we have given read only access to the file.

We need to again delete these already formed files or change the filename if we want to again store details.

In this application, we are not appending the file instead we are overwriting the old details mentioned in it in case we don’t grant access.