Encoding Arrays with File Paths
Richard Gaskin
ambassador at fourthworld.com
Tue Feb 25 13:03:35 EST 2025
Bob Sneidar wrote:
> I played around with this last night, and determined that the length does
> not have to be sent, the receiving process can simply keep reading for n
> characters, appending the data to a low level file in a repeat loop until
> the it variable is empty. I tried this and the entire payload was received.
>
> I think the advantage to this method is that I do not have to worry about
> file size, as any file can be transferred using this method, whereas
> otherwise a file can theoretically be large enough to overwhelm the sender
> or receiver.
I hope Mark Waddinghham will correct me if I'm wrong on this, but I believe the looped chunking you're scripting is effectively what happens automatically when you write the whole data.
I would be reluctant to rely on a handful of tests alone, and it never hurts to wear both belt and suspenders. I'm assuming HTTP 1.1 added a requirement for specifying payload length for good reason.
If I understand the protocol well enough, you're already sending metadata (for the file name), yes? What's a few more bytes in that header to add payload size?
This excercise raises a question: rather than invent another protocol, why not use HTTP? Saves dev time, eliminates the need to write and maintain documentation for a custom protocol, leverages existing robust tooling, allows for integration with other packages as customer needs evolve, and stakeholders often get to buy-in faster where open standards are employed.
--
Richard Gaskin
FourthWorld.com
More information about the use-livecode
mailing list