Expert
1694 Order Completed 96 % Response Time 102 Reviews Since 2013

Computer Science Homework Solver

New York, USA

Dennis L

Ph.D. in Computer Science, City University of New York

Profession

Computer science homework solver in New York

Skills

I am one of the most demanding computer science homework solvers in New York for my ability to work with students and solve their programming assignments. I understand the entire computer science discipline, but I am specialized in artificial intelligence. I joined programminghomeworkhelp.com 7 years ago, and since then, I have helped more than 1600 students with their assignments. I have provided help in machine learning and JavaScript, as well as preparing students for their exams. If you are looking for a quality programming assignment helper, then contact me today.

Get Free Quote


 Your Order has been sent successfully. We will contact you as soon as possible.
Error: Please try again

Transfer of Data Between Client and Server

Design Document

The idea of the project is to allow data transfer between server and client. A client can either upload a file or download a file from or to the server. Upload means data transfer is done from the client going to server and download means data transfer is done from server to client. The protocol being used is UDP in which data are being sent in packets. It means that when we want to transfer a file, we have to break it down into packets and send them. It is not possible to send one big file as is to the network. UDP is a connectionless protocol. It means that there is no guarantee that all packets will be received by the receiver. In other words, file transfer can be faulty and unreliable. When packets get lost, upload/download of the file is incomplete and the ending result is a corrupted file.

Server Class

The server class opens a port where to listen for incoming packets. When a packet arrives, it will be rebuilt as a “Message” object. The object contains details about the received data that came from a client.  If the received message is for upload, the server will simply extract the file data and write it to a file. If the received message is for download, the server will check how far the client has already downloaded a file and then gets the next chunk of data and sends it back to the client.

Client Class

The client class gives the option to the user whether to upload or download a file.  If the user wants to download a file, they have to enter a filename of a file that exists on the server. The client will keep track of how much data has already been collected. It will keep on sending the server these data as a "Message" object. The server will receive it and then knows the next chunk of data to give back to the client. The process repeats until the client receives all data that is needed and writes them to file. If the user wants to upload a file, the program will break down the file into chunks and then puts each chunk as a “Message” object. For every message, it sends it to the server to receive. The server will collect and get all these chunks of data and write it to a file.

Message Class

An object that contains details of a packet being transferred between client and server. These details include:
  1. Filename: Name of a file being uploaded or downloaded.
  2. File data: Partial bytes of data of a file that is currently being uploaded or downloaded.
  3. File data size: The size of the bytes of data being uploaded or downloaded.
  4. Expected File Size: This is only useful when performing a download. This information will let the downloader know how much data needs to be transferred.
  5. Downloaded File Size: This is only used when performing a download. This information will let the server know how much data has already been downloaded by the client.
  6. Type: Defines the type of message whether the data it contains is for “Upload” or “Download”.

Sample Scenario Execution

Here we have the server directory which contains the classes to run a server and the directory called “server_files” where uploaded files or files to download goes.
Transfer of Data Between Client and Server

This would be the initial content of the “server_files”:

Transfer of Data Between Client and Server

Here we have the server directory which contains the classes to run a server and the directory called “server_files” where uploaded files or files to download goes.

Transfer of Data Between Client and Server

This would be the initial content of the “client_files”:

Transfer of Data Between Client and Server

We open a terminal and run the server for a specific port:

Transfer of Data Between Client and Server

We open another terminal and run the client. The client resides on the same computer as the server that’s why we use the IP address 127.0.0.1. The port should be the same port used by the server when it was executed:

Transfer of Data Between Client and Server

To demonstrate an upload, we choose the upload option and type in the filename of a file that resides in the "client_files” folder: Transfer of Data Between Client and Server

After a successful upload, the server will receive the file inside the “server_files” folder:

Transfer of Data Between Client and Server

To demonstrate download, we choose the download option and type in the filename of a file that resides in the “server_files” folder of the server: Transfer of Data Between Client and Server

After a successful download, the downloaded file is inside the "client_files” folder:

Transfer of Data Between Client and Server