Non-serious project to get my feet wet in UDP Datagrams and Electron. Not suitable for use in the real world. Can overload the network with binary UDP packets if large files are transferred.
- Can act as client and/or server in the one running app
- Share variable amount of files as server
- Fetch list of available files as client
- Ask for data broadcasting
- Broadcasting of file chunks
- Transfer progress
- Transferred file checksum verification
- Transferred file opening
- Packet loss simulation
- Lost packets resending
- Detailed configuration support
Configuration can be done using config.json:
./resources/app.asar.unpacked/config.json
in the packed format./package.json
during development
Name | Description | Default |
---|---|---|
ENABLE_SERVER | Enable server part | true |
ENABLE_CLIENT | Enable client part | true |
CHUNK_SIZE | Size of the file chunk sent over the network | 1000 |
SERVER_IP | Server IP adress | "localhost" |
BROADCAST_ADDRESS | IP address used for data broadcasting | "192.168.1.255" |
META_PORT | Port used for meta (plaintext) communication | 10000 |
DATA_PORT | Port used for data (binary) communication | 10001 |
POLITE_REQUEST_WORD | Word used in the end of requests | "PLS" |
POLITE_ERROR_WORD | Word used at the beginning of error messages | "SRY" |
MAX_FILES | Maximum number of files that can be picked via Server | 5 |
DOWNLOADS_FOLDER | Folder used for downloads | "downloads" |
SIMULATE_PACKET_LOSS | Simulate random packet loss | true |
PACKET_LOSS_PROBABILITY | Probability that some packets will be lost 0.001 = 0.1% probability packets will be lost 1 = 100% probability packets will be lost 0.001 or less is recommended |
0.001 |
ENABLE_PACKET_LOSS_RECOVERY | Enable recovery of lost packets Lost packets will be requested at the end of receiving |
true |
ENABLE_DEBUG | Enable debuging Developer tools can be opened using Ctrl+Shift+I |
false |
ENABLE_DEBUG_LOGGING | Enable logging to console | true |
ENABLE_DEBUG_VERBOSE | Enable verbose logging WARNING: Can lead to great number of logged info if large files are used since a lot of repeating messages are logged and all received data objects are logged Please use only on considerably small files which can fit within few packets |
false |
Requirements:
- Node.js v6 LTS + NPM
- Windows for win32 packaging
Clone this repository and install dependencies:
git clone https://github.com/durasj/Polite-UDP-Transfer.git
cd Polite-UDP-Transfer
npm install
After file changes, run npm start
. The project should be built and the app opened.
For 64-bit win32 and linux folder packaging, run npm package
To create 64-bit win32 and linux installable, run npm dist
See package.json for more available commands
- Electron (Node and Chromium)
- Typescript
- Vue.js
- Material components
- ... and others, see package.json
Directory ./src
contains raw source code. Directory ./build
compiled/copied source code ready to be used by Electron.
File ./main.js
is processed as first by Electron to bootstrap the application by creating the main window with ./build/index.html
, which loads some ui dependencies and index.js
, index.css
.
Communicates politely on two ports:
- Meta port default 10000
- Data port default 10001
- Plaintext, UTF-8 encoding
- Server listens on predefined port default 10000
- Server responds to these commands:
LIST
- Get JSON array of file infoGET $fileId$
- Request file data broadcastingPARTS $fileId$ $binary list of UInt32 part indexes$
- Request missing specific file data parts broadcasting
- Server error responses:
NOT IMPLEMENTED
- required command is not implementedUNKNOWN FILE
- sent file identifier doesn't match any file on the server
- Binary data broadcasting
- Client listens on predefined port default 10001
- Server can broadcast file data messages to that port (if asked politely)
- Message format:
$fileId$ $index of chunk$ $binary data chunk$
- Message format:
- Only in meta communication
- Every request ends with predefined polite word default PLS, e.g.
LIST PLS
, with the exception of the PARTS command, which includes polite word before the binary list of the indexes - Every response error starts with predefined polite word default SRY, e.g.
SRY NOT IMPLEMENTED