Call/WhatsApp: +1 332 209 4094

Computer science; Java, linux

 

Computer science; Java, linux

Question 1: (15 marks)

Distributed systems

This question is fifteen (15) marks worth.

The FTP (File Transfer Protocol) utility program is commonly used for copying files to and from other computers. These computers may be running at the same machine or at different machine. FTP is a general protocol that works on UNIX systems as well as a variety of other (non-UNIX) systems.

Nowadays, most operating systems and communication programs include some form of an FTP utility program, but the commands might differ slightly.

Today almost, all operating systems come shipped with a type of FTP program including windows OS.

This short TMA requires an implementation of a File Transfer Protocol using TCP sockets in JAVA. Only one command needs to be implemented in this program which is:

  • PUT: Transfer a text file from client to a server

 

The client specifications for “PUT file name” command [5 marks]:

  • The file name should be passed as argument to the client program when executed
  • The client should connect to the server using TCP sockets on port “4000”, you can assume that the server is running on the local host machine.
  • First, the client should send the command “PUT file name” to the server.
  • Thereafter the client sends the text file line by line.
  • Once the file transfer is finished the client closes the socket connection.
  • You need to print on the client screen messages to show the progress of the file transfer command execution.

 

The Server specification for “PUT” command [5 marks]:

  • The server should listen on port “4000”.
  • Once a client connects to the server, the server should verify the command to be “PUT” and extract the file name. Then create a local file using the received file name.
  • Thereafter the server start receiving the file from the client and write it in the file.
  • Once the file transfer is finished the server closes the socket connection and the local file.
  • You need to print on the server screen messages to show the progress of the file transfer command execution.

 

In order to allow the server to serve multiple clients at the same time, the server should be modified into a multithreaded application, where each client request is served using a single thread.

Modify the FTP server by adding the flowing specification [5 marks]:

Once a client connects to the server, the server should create a thread to receive the client command and the file, then it should wait immediately for another client connection request.

 

 

 

Question 2: (5 marks)

Bash Shell script

 

This question is five (5) marks worth.

 

Write a bash shell script that does the following [4 marks]:

Expects three arguments on the command line: the server name, the client name applications and the file name to be sent.

It checks if the number of arguments equals to three, if not it displays an error message.

If the number of arguments is correct, it executes first the server followed by the client and then it displays the running processes including the thread.

Finally, it lists the file and folders in the current directory.

Execute the bash script and provide a screen shot [1 mark].

Either use a virtual machine running Linux image or use the Cygwin https://www.cygwin.com/ tool on windows platform to run your bash shell script.

 

Format and structure of the deliverables:

We expect a NetBeans project containing all the required implementations including the bash script file and the screen shots in one zip file to be uploaded.

Use the following naming convention for your zip file:

“BranchName_YourName_yorID_STMA_M251_Sp202.zip”

                                                                                                              End of Assessment