Scheduling algorithms in C++Algorithm scheduling is the process of determining which algorithm or line of code will be executed in the Central Processing Unit (CPU) and which one will be put on hold awaiting processing. In C + + programming, scheduling ensures that there is always an algorithm avail...
Transfer of Data Between Client and Server
- Filename: Name of a file being uploaded or downloaded.
- File data: Partial bytes of data of a file that is currently being uploaded or downloaded.
- File data size: The size of the bytes of data being uploaded or downloaded.
- 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.
- 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.
- Type: Defines the type of message whether the data it contains is for “Upload” or “Download”.
Sample Scenario Execution
This would be the initial content of the “server_files”:
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.
This would be the initial content of the “client_files”:
We open a terminal and run the server for a specific port:
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:
To demonstrate an upload, we choose the upload option and type in the filename of a file that resides in the "client_files” folder:
After a successful upload, the server will receive the file inside the “server_files” folder:
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:
After a successful download, the downloaded file is inside the "client_files” folder: