This repository contains a simple file transfer application using TCP sockets in Python. It consists of a server and a client that allow you to send files from the client to the server.
To run this application, you need to have the following installed:
- Python (version 3.7 or higher)
- pipenv (for managing the virtual environment)
-
Clone the repository to your local machine:
git clone https://github.com/shitan198u/File-Transfer-Using-TCP-Socket.git
-
Navigate to the project directory:
cd File-Transfer-Using-TCP-Socket
-
Install pipenv if you haven't already:
pip install pipenv
-
Create a virtual environment and install the dependencies:
pipenv install
This will automatically create a virtual environment and install the required dependencies (
pyqt5
andtqdm
) specified in thePipfile
. -
Activate the virtual environment:
pipenv shell
The server should be run first before starting the client.
To start the server, run the following command:
python server.py
The server will start listening for incoming connections on 0.0.0.0:5555
. When a client connects and sends a file, it will be received and saved in the ./REC
directory.
To start the client application, run the following command:
python client.py
The client application will open a graphical user interface (GUI) window. Follow these steps to send a file:
- Click on the "Choose File" button to select the file you want to send.
- The selected file's name will be displayed below the button.
- Click on the "Send File" button to start sending the file to the server.
The progress of the file transfer will be displayed in the console, showing the transmission speed and progress bar.
Here is an example workflow demonstrating how to use the file transfer application:
-
Start the server:
python server.py
The server will start listening for incoming connections.
-
Start the client:
python client.py
The client application window will open.
-
Select a file to send:
- Click on the "Choose File" button.
- Browse your filesystem and select the file you want to send.
- The selected file's name will be displayed below the button.
-
Send the file:
- Click on the "Send File" button.
- The file transfer progress will be displayed in the console.
-
Verify the file transfer:
- On the server-side, the received file will be saved in the
./REC
directory.
- On the server-side, the received file will be saved in the
Note: Make sure to start the server before running the client and ensure that both the server and client are running on the same network.
Contributions are welcome! If you have any suggestions, improvements, or bug fixes, please open an issue or a pull request.
This project is licensed under the MIT License.
This project was inspired by the need for a simple file transfer mechanism using TCP sockets in Python. Special thanks to the developers of PyQt5 and tqdm for their excellent libraries.