Question

I need to send a photo from one mobile phone to another. Currently, I'm splitting the image up into bytes before sending and then reassembling the image on the second mobile. This works fine, but if the photo is large (and they keep getting larger due to the better cameras on phones), then it takes some time for the photo to be received by the second mobile.

Would trying to stream the photo offer a better experience? It seems that streaming would be faster because, theoretically, multiple frames would be received per second. Would streaming be faster than sending the photo in chunks of bytes? If so, why?

Was it helpful?

Solution

Not necessarily. No matter what you do, you have to deliver the same amount of data. There's no way round this. So whether you split it yourself and send chunks, or let the network layer do it under the covers is irrelevant. Now the network layer might be better at it than you - you can screw the transfer by splitting into too small chunks, so you could first see if increasing the file size makes things faster (on a LAN recent testing with a legacy system that sent 4k chunks went significantly faster when we upper the chunk size to 1Mb).

Typically I'd stream and let the network do the work for you though. Error handling is slightly more complex than chunked transfer but hopefully someone else will have taken care of this for you in a library.

One thing you can do to increase the experience is to give the end-user a smaller file transfer first (a thumbnail) so they can see if they'd like to wait for the full file transfer. The best experience sending an image is not to send it at all sometimes.

OTHER TIPS

Sending the photo in chunks of bytes could actually represent a kind of streaming, because the streaming concept just means being able to reproduce some file at client side without the need of it being fully downloaded.

Actually, the speed you're referring to is dependent on the protocol and technologies being used to transfer the file. As for this, you should better analyze the options you've got with that protocol and make a decision based on them.

Licensed under: CC-BY-SA with attribution
scroll top