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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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