Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File transfers by using MQTT

I'm developing a C++ application that will be able to communicate with a remote server, I'd like to use MQTT because it's reliable and easy to implement. I'll also need to make file transfers and I wonder if it is possible to do this with MQTT.

If so, is it possible to get the download progress status and the download speed?

I searched on Google and it seems to be possible but I didn't get very clear answers.

I thank you

like image 500
Avenger Avatar asked Oct 29 '25 11:10

Avenger


1 Answers

MQTT is a messaging system, you can include what ever you want in the message.

MQTT message payloads are just a collection of bytes, using these to send a file is trivial (assuming the file is less than 256mb in size as this is the max size of a single message)

If you want to send larger files then you would have to implement a scheme for breaking it up into smaller parts, this could include things like filename, number of parts, current part number, total file size.

With that information you could determine transfer rate, but given the first you would see of a file that fits into a single message would be the whole message arriving in memory of your client it wouldn't make calculating speed hard. If you really need that then the best bet would be to break files into MUCH smaller parts.

like image 175
hardillb Avatar answered Nov 01 '25 03:11

hardillb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!