/Multi-Threaded-Web-Server-and-FTP-Client

This project implements a multi-threaded web server in Python and extends it to act as an FTP client. The server handles various file requests and integrates FTP functionality to serve text files upon request.

Primary LanguagePython

Multi-Threaded Web Server and FTP Client

Overview

This repository contains an implementation of a multi-threaded web server and an FTP client. The project is divided into two main tasks:

  1. Task 1: Implement a multi-threaded web server in Python.
  2. Task 2: Extend the web server to act as an FTP client to download text files from a local FTP server.

Getting Started

Prerequisites

  • Python 3.x
  • Docker (for setting up the FTP server)

Installation

  1. Clone the repository:
    git clone https://github.com/qme02/Multi-Threaded-Web-Server-and-FTP-Client
    cd Multi-Threaded-Web-Server-and-FTP-Client
    

Docker Setup for FTP Server

  1. Install Docker:
  1. Run the Docker container for the FTP server:
    docker run --rm -it -p 20:20 -p 21:21 -p 4559-4564:4559-4564 -e FTP_USER=1234 -e FTP_PASSWORD=1234 docker.io/panubo/vsftpd:latest
    
  2. List running Docker containers to find the container ID in a new terminal window:
    docker container ls
    
  3. Log in to the container and change ownership of the FTP directory:
  • Replace <CONTAINER_ID> with the actual container ID from the previous step.
    docker exec -it <CONTAINER_ID> /bin/bash
  • Inside the container, change the ownership of the FTP directory:
    chown ftp:ftp /srv
    
  1. Create a test file in the FTP directory:
  • Still inside the container, create a test file:
    echo "Hello World!" >> /srv/ftp_test.txt
    
  1. Verify setup by accessing files through the web server: