ASSIGNMENT 5:
Text File Download by Client from Server
Problem Statement: Write a program to create a server that listens to port 55 using stream
sockets. Write a simple client program to connect to the server. The client should request for a
text file and the server should return the file before terminating the connection
Date: 4th February 2025
Name: Yashaswini Gottumukkala
Registration Number: 2023001306
Step 1: Writing a python script for setting up a simple TCP server that listens for
connections of port 55 and sends the requested text file.
The code is stored under server.py
Step 2: Writing a python script to set up a simple TCP client that connects to a server on
port 55, requests a file and receives the file content.
The code is stored under client.py
Step 3: Create a folder named pythonscripts and save both server.py and client.py in it.
Also save the file to be requested by the client here.
The file being used for this assignment is “sample.txt” and the contents of it are displayed
below.
Step 4: In command prompt, run the server.py script
Step 5: Open another window on command prompt and run the client.py script
Step 6: Enter the filename to be requested from the server. (Here, the file being used is
sample.txt)
Step 7: Once the file is requested, the server reads the file and sends it to the client. After the
file contents are sent the connection is closed.
Step 8: After the file is sent by the server, its contents are received by the client and
displayed on the screen.