tftp

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

tftp

tftp plugin #
Libraries for creating TFTP servers and clients
TFTP: Trivial File Transfer Protocol
How To Use #
Server #
We can start a tftp server, and then a tftp client could download/upload file from server.
The server has onRead,onWrite and onError event.
For example:
var server = await TFtpServer.bind("0.0.0.0", port: 6699);
server.listen((socket) {
socket.listen(onRead: (file, onProcess) {
print("read file from server:$file");
onProcess(progressCallback: (count, total) {
print("read:${count / total}%");
});
return "$readAblePath/$file"; // server will read file from return value
}, onWrite: (file, doTransform) {
doTransform();
infoController.add("write file to server:$file");
return "$writeAblePath/$file"; // server will write file to return value
}, onError: (code, msg) {
infoController.add("Error[$code]:$msg");
});
});
copied to clipboard
client #
We can create a tftp client to download/upload file to a tftp server.

init

var client = await TFtpClient.bind("0.0.0.0", port);
copied to clipboard

Get

client.get(localFilePath, remoteFilePath,remoteHost, remotePort);
copied to clipboard

Put

client.put(localFilePath, remoteFilePath,remoteHost, remotePort);
copied to clipboard
Tips: #
If you want to read/write file to EXTERNAL STORAGE,you should
Add permissions in AndroidManifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.