Building a simple fss using a simple command line interface

Assignment Help Computer Engineering
Reference no: EM131936650

Programming Assignment

File Sharing System (FSS) using only Java sockets

You are charged with building a simple file sharing system (FSS) using a simple command line interface. The FSS consists of two types of entities: a file server and many clients. In this FSS:

• The client MUST be able to upload files to the file server. It's fine to upload them one at a time. If the file already exists, replace it.

• The client MUST be able to download a given file from the file server, by providing the full filename path to the file server. If the file does not already exist, it MUST return an error message on standard error and return a non-zero error code.

• The client MUST be able to list the file system objects (files and directories) on a file server directory, including the file server's root ("/") directory. If the requested directory does not exist, it MUST report an error message on standard error and return a non-zero error code.

• The client MUST be able to create a directory (if the directory does not exist) and remove empty directories (if the directory is empty), and MUST be able to report whether or not these operations succeeded. If there's an error, it MUST report an error message on standard error and return a non-zero error code.

• The client MUST be able to remove a given file from the file server, by providing the full filename path to the file server. If the file does not already exist, it MUST return an error message on standard error and return a non-zero error code.

• The file server MUST allow multiple clients to simultaneously connect to a single file server for upload/download, and allow for apparently-simultaneous transfer (e.g., it's NOT okay for the file server to wait for one transfer to complete before another begins).

• Clients MUST be able to cleanly shut down the file server.

• The system MUST support the resume upload and download: If a file transfer between a client and a server is interrupted (because the network, server, or client has failed), the same client MUST be able to resume upload/download at the file server from the same point of progress by re-requesting the same filename. In other words, the client MUST NOT have to upload/download the data that is already uploaded/downloaded. Note that you have to handle server crashes too - you may want to use "flush()" in the server. In order for the TA to verify that you have implemented this functionality the program MUST print the progress of upload/download as it's proceeding, including an indication that a partial download is skipping re-download of some portion of the file.

The client will need to know how to contact the server; for this exercise, the client MUST accept this in an environment variable named PA1_SERVER with the computer name, a colon, and the TCP portnumber (e.g., "localhost:8000"). The server will need a place to store its data; its file system "root" MUST be the current directory for when it is started.

Do not make any other assumptions about the properties of the file. The file sharing system MUST be able to exchange files of any type and with arbitrary filenames. Note: Linux/Unix filesystems are normally case-sensitive, but Windows/MacOS are normally case-insensitive; you don't need to provide case-sensitive functionality on non-case-sensitive systems, but it MUST maintain the upper/lower case provided to it since that information matters on some systems. If there's no error, return an error code of 0 (no error).

When developing your system you MUST use Java, and for the networking portions you MUST use ONLY the Java sockets libraries (no JMI, etc.). No other use of third party software is allowed, unless explicitly permitted by the instructor. For purposes of this exercise we'll totally ignore security, e.g., no authentication or authorization is needed. Note that illegally downloaded files (i.e., files violating the copyright laws) may not be used for developing, testing, or demoing your assignment.

Deliverables

• Executable and self-contained jar files.
• A read-me text file.
• Source Code in Java.

Executable and self-contained jar files: The program MUST be implemented as a single jar file containing both server and client.

A read-me text file: The text file MUST provide step-by-step instructions for running and testing your software. It MUST also clearly list the location of server's storage folder i.e. the location where the server stores the received files.

Source Code in Java: the source code submitted for your program MUST match the executable jar file.

Below are commands that your system MUST support (we plan to create a test script), in order of the overall requirements above. Unix syntax shown:

java -cp pa1.jar server start <portnumber> &
# To set up client so it knows what server to talk to:
export PA1_SERVER=<computername:portnumber> # On Windows: set PA1_SERVER=.....
java -cp pa1.jar client upload <path_on_client> </path/filename/on/server>
java -cp pa1.jar client download </path/existing_filename/on/server> <path_on_client>
java -cp pa1.jar client dir </path/existing_directory/on/server>
java -cp pa1.jar client mkdir </path/new_directory/on/server>
java -cp pa1.jar client rmdir </path/existing_directory/on/server>
java -cp pa1.jar client rm </path/existing_filename/on/server>
java -cp pa1.jar client shutdown

Below is an example:
mkdir -p server ; cd server
java -cp pa1.jar server start 8000
cd .. ; mkdir -p client1 ; cd client1
export PA1_SERVER=localhost:8000
java -cp pa1.jar client upload text1.pdf /folders/text1.pdf
Uploading file .... 50% (changes real-time)
File uploaded.
(start another client)
cd ..; mkdir -p client2 ; cd client2
java -cp pa1.jar client download /folders/text1.pdf copy_of_text1.pdf
Downloading file .... 50% (changes real-time)
File Downloaded.
java -cp pa1.jar client shutdown

Wrong instructions or faulty jar file would prevent the TA from grading your assignment.

Turn in your program (both source code and compiled jar) via Blackboard.

Reference no: EM131936650

Questions Cloud

Identify managerial challenge for healthcare organisation : MHS8.437 Health Management Assessment. Write a report in which you identify one managerial challenge for one healthcare organisation of your choice
Find the maximum price you should be willing to pay : Assume that you are considering the purchase of a 9-year, noncallable bond with an annual coupon rate of 8.75%. The bond has a face value of $1000.
Find what is the option time premium : Assume that a certain stock's current price in the open market stands at $32.25 per share. The premium on the call option for this stock is currently $5.21.
What is the rule of 72 and why is it important : What is the Rule of 72 and why is it important? We cannot compare two loans based on APR if they do not have the same compounding period.
Building a simple fss using a simple command line interface : You are charged with building a simple file sharing system (FSS) using a simple command line interface. The FSS consists of two types of entities.
What are the after-tax cash flows for the company : Assume a corporation has earnings before depreciation and taxes of $102,000, depreciation of $63,000, and that it has a 30% tax bracket.
Obtain a tax benefit for the interest charged : Explain how it could be possible to borrow 100% of the purchase price and obtain a tax benefit for the interest charged.
What proportion of risk can be diversified away : Suppose that you can either invest in Walmart and the risk free treasury bills OR invest in Google and the risk free treasury bills.
What is the historic risk of different financial assets : What is the historic risk of different financial assets of the U.S. economy and what can we do with their historic risk premium?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a function that will generate an access array

Write a function that will generate an access array for finding the first entry of each row of a table of this shape within the contiguous array.

  Describe the execution of push and pop operations

What is a stack? Why is it needed? Describe the execution of push and pop operations. What s the difference between a physical access and a logical access?

  Draw a data model for the entities and considering entities

Draw a data model for the following entities, considering the entities as representing a system for a patient billing system and including only the attributes that would be appropriate for this context.

  Description of problems and business impacts

Description of problems and business impacts

  Build a pn interpreter that will work interactively

Build a PN interpreter that will work both interactively and in batch. In the former case, the nondeterminism of the model can be resolved by the user.

  Evaluate the amplitude-modulated pam signal

In a carrier-amplitude-modulated PAM system, the transmitter filter has a squareroot raised-cosine spectral characteristic with rolloff factor ex = 0.5.

  Explain the fundamental components of a distributed system

explain the fundamental components of a distributed system.

  Make an abstract class called aqualife

Fish has an attribute that stores whether the fish is an herbivore or a carnivore. Its eats method checks whether herbivore or carnivore, and prints 'This fish eats veggies' for herbivores and 'This fish eats other fish' for carnivores.

  Give the type of clip art found at the sites

search on the Internet for at least 2 additional sites other than Microsoft's that offer clip art, either free or for a price. If you have real-life or professional experience with clip art sites.

  Select a card randomly from the stack

There is a stack of10cards, each given a different number from1to 10. Suppose we select a card randomly from the stack, replace it, and then randomly select another card. What is the probability that the first card is an even number and the second..

  How do you display the inode number of a file

How do you display the inode number of a file? How do you ensure that all ordinary files created by you have rw-rw---- as the default permissions?

  Explain how hacking trojans and computer viruses are used

Explain how hacking, Trojans, and computer viruses are used as tool in cyber terrorist's arsenal of weaponry. Which do you feel is the most destructive and why?

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