Send and recv files with people around you with ease and speed
DirectTransfer provides an easy way to share files with people around you or on the current network. It uses TCP over sockets to transfer files and folders, completely peer to peer. DirectTransfer allows the user to send or receive multiple files / folders with or from multiple devices at the same time, parallely.
- UI initiates a send (from the Host machine)
- Host machine talks to the HTTP server of the Client machine, asking for an open TCP port
- Client UI tells the Client HTTP server to open the TCP port
- Client HTTP server queries to open a TCP port
- Client HTTP server retrieves the opened port number
- Client HTTP server sends the port number to Host HTTP server
- Host HTTP server queries to send the file to the retrieved port
- Host sends the file to the Client through the now established TCP connection
As a user, there are two ways I can send files:
A send is initiated by me to a client, the client accepts the file I expose an index of files that client can request from me, the client requests a file and I send it to them.
It consists of two parts:
Daemon: A simple HTTP server. All core network function calls are initiated by this server.
UI: talks to the daemon server for any actions.
To setup the development environment, first install all the dependencies
pip install -r requirements.txt
Then manually start the server
python daemon/server.py
Then use the CLI to interact with the server
DirectTransfer provides a simple Command Line Interface to send files
python ui/cli/cli.py
Usage: cli.py [OPTIONS] ACTION
Actions:
send: Send files to a client
receive: Listen for files and reveive them
Options:
-c TEXT (send only) Client IP
-p TEXT File or directory path
--help Show this message and exit.
daemon/
contains all the code related to the daemondaemon/server.py
contains the code for the HTTP server written in Flaskdaemon/net/
contains all the TCP network codedaemon/net/asclient.py
contains code for peer acting as a client (recieving files)daemon/net/ashost.py
contains code for peer acting as a host (sending files)