Write this in Python The goal of this project is to practice your Application and Transport Layer

Write this in Python: The goal of this project is to practice your Application and Transport Layer skills by implementing (i) a cache service for file exchange, and (ii) two reliable data transport protocols. The project will be completed in two phases. In the first phase, all students will implement two versions of the program: one that uses stock TCP1 for reliable data transfer; and one that implements stop-and-wait (SNW) reliability at the application layer and uses UDP for transport. In the second phase, graduate students will be asked to evaluate and compare the stock TCP and the stop-and-wait implementations using Wireshark. Your application will support file upload and download using a cache. There will be three components to your program: a client, a server, and a cache. All exchanges (upload or download) will be initiated by the client. Each attempt to download a file will first check with a cache to see if the file is available locally, and only if a target file is unavailable locally, it will be requested from the server. Each attempt to upload a file will store that file directly onto the server, not including the cache in the communication process. • Supported commands: Your program should allow a user to upload and download files, and to quit the program. To this end, you will implement the following commands: • Upload: Copy a file from the client to the server using the put command, which takes as an input argument the full path to a file on the client. Upon a successful receipt of a file, the origin server would send back “File successfully uploaded.” message and close the connection. This functionality should follow the Upload interactions illustrated in Figure 1. Example execution with prompts on the client: put File successfully uploaded. • Download: Copy a file from the server to the client using the get command, which also takes as an argument the full path to a file on the server. This functionality should follow the Download interactions. Specifically, the client should first connect to the cache to download the file locally. Upon successful receipt of the file from the cache, the client would close the connection and display “File delivered from cache.”. Note that this message should come from the cache, rather than being generated locally on the client. If the cache determines that the file is unavailable locally, the cache will request the file from the origin server on behalf of the client, store the file locally for further requests and deliver the file to the client. A control message sent from the cache to the client stating “File delivered from origin.” must be displayed to the user. Example execution with prompts on the client: – File available on cache: get File delivered from cache. File NOT available on cache: get File delivered from origin. • Quit the program per user request. quit • Commandline inputs. When starting your client, server, and cache, you will need to specify several commandline inputs, as detailed below: – Client – the client will take as commandline inputs (1) the server IP, (2) the server port, (3) the cache IP, (4) the cache port and (5) the transport protocol to be used. Input arguments should follow that specific order. Some example executions of your client are: client.py localhost 10000 localhost 20000 tcp Enter command: client.py localhost 10000 localhost 20000 snw Enter command: – Server – the server will take as commandline inputs (1) a port on which to run and (2) a transport protocol to be used, in that specific order. Sample runs of the server include: server.py 10000 tcp server.py 10000 snw – Cache – the cache will take as commandline inputs (1) a port number on which to run, (2) server IP, (3) server port, (4) transport protocol to be used, in that specific order. Sample runs of the cache include: cache.py 20000 localhost 10000 tcp cache.py 20000 localhost 10000 snw All command exchanges (i.e. interactions designated with red dashed arrows in Figure 1) must be performed using TCP. File exchanges will use either TCP or stop-and-wait reliability depending on the invocation. Starting the client; accepting user-specified commands3: icsi416-fa23% client.py localhost 10000 localhost 20000 tcp Enter command: put test.txt Awaiting server response. Server response: File successfully uploaded. Enter command: get test.txt Server response: File delivered from origin. Enter command: quit Exiting program! icsi416-fa23% Your application should behave the same way with both stock TCP and stop-and-wait reliabilityMake sure to use large files to test the code. Show the full code for each file and screenshots of the output. Don’t give the explanation. I need the code for each file in Python. All the codes must work.


 
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.

 
Instant
Download

Student review: (4 ratings) 4 out of 4 people found this solution helpful.