B4J Question How to send large file from B4J to B4A, via Mqtt ?

amorosik

Expert
Licensed User
I would like to send files of a few tens of megabyte, via Mqtt, from a pc workstation with the B4J program to an Android device with B4A app
How do i send large files?
There is an upper limit for single submission?
Mosquitto is the broker
 

DonManfred

Expert
Licensed User
Longtime User
There is an upper limit for single submission?
8kb is default.

Not sure about his one though; Also note that the payload is send in one package. Means on the sending AND receiving side you must have enough RAM to send/get the package.

You can set the size with.

For user experience you should split the file on serverside and send only small packages. I don´t think it is suitable to send tens of MBs in one payload.

One Solution (you don´t need to change the default payloadsize at all with it).
Split the original file in small parts of 8, 16, 32 kb...
Create a customtype with file to send, amount of parts, one part of the file as bytearray.
Serialize the customtype. Send the serialized payload. Send all 1587 (just an example) parts of that file....
On receiverside you get the serialized payload, get the nr and amount of parts you need.
Store them until you know you have all parts. Rebuild the originalfile based on the parts you received.
 
Last edited:
Upvote 0

amorosik

Expert
Licensed User

It's not exactly a health walk ?
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
I would like to send files of a few tens of megabyte, via Mqtt, from a pc workstation with the B4J program to an Android device with B4A app
How do i send large files?
There is an upper limit for single submission?
Mosquitto is the broker
Hi there...

you ve already have my Remote Administration via MQTT you can check the part of file-transfer... with mqtt free broker hivemq the limit is 200KB/msg... but for compatiblity reasons with other brokers i ve setted it at 32Kb... it is easy to change this buffer... Actually tested with 1,5GB transfer (with a buffer of 200KB)... and it was pretty good...

split your file at many pieces and send it
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…