开发者

Receive and display JPG image through UDP

开发者 https://www.devze.com 2023-04-11 08:33 出处:网络
I am a beginner with Andoroid. I just create an UDP chanel and receive image package(1000bytes). But I have no idea h开发者_开发问答ow to display it. What should I do or refer to?If you have access to

I am a beginner with Andoroid. I just create an UDP chanel and receive image package(1000bytes). But I have no idea h开发者_开发问答ow to display it. What should I do or refer to?


If you have access to the packet payload as a byte array you can create and Image instance from it. Code sample

EDIT:
If the image is sent in multiple packets you have to order them correctly. UDP headers has no info for ordering (and there is no guarantee that some won't get lost more info) so you have to provide your own ordering in the payload or switch to TCP.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号