Generating File Sharing Server Using Python

Handhika Yanuar Pratama
3 min readApr 18, 2024
Photo by Elaine Casap on Unsplash

File sharing server is a platform or a system that used by users share their file through the network. This system could be operate locally or through the internet. This server is using some protocol for doing their job. Some protocol that commonly used are FTP, SMB, and HTTP.

But, why Python?

Python’s http.server module provides a simple HTTP server that can serve files from your local directory over the HTTP protocol. It's a built-in module in Python, making it very convenient for simple file sharing or testing web applications locally.

Program

Open your terminal and make sure you have Python on your system

If your terminal display like that, it’s mean Python already installed on your system. Next just simply run this command on your terminal.

python -m http.server 4444

The number 4444 is the port to access the server.

After you run the command on your terminal, you will be asked for the permission for Python accessing the network, just click “Allow”

Okay, right now on other terminal, check your IP address, using ipconfig.

Here is the result when you access via your browser

Here is the result when you access via your phone

Issue

If you encounter issue, that makes your other devices can’t access the server, probably it was your firewall configuration.

Open your firewall and click on Allow an app through firewall

Checklist both Private and Public network configurations

It will work successfully.

Conclusions

For you who don’t really knows about networking, and encounter the issue even after doing the troubleshoot, maybe you are not in the same network. Since Python only open this feature for local connections. Maybe, in near future, it will work for public connections. Just be curious!!!

Okay, I hope you do enjoy this article, thanks for reading.

--

--