开发者

Read data from stream without blocking next reads

开发者 https://www.devze.com 2023-02-09 03:18 出处:网络
In my \"video chat\" I transfer picture, voice and text from cli开发者_JS百科ent to server. My problem is that I can\'t read incoming text while reading a picture. The picture transfer must be finishe

In my "video chat" I transfer picture, voice and text from cli开发者_JS百科ent to server. My problem is that I can't read incoming text while reading a picture. The picture transfer must be finished so the text transfer can begin.

Do I have to create a new connection to read at the same time when another read is running?


Well, it depends how you do it. You could design a protocol which would allow the interleaving of two logical streams... but it would be cumbersome for both reading and writing... and you'd still have a problem if you wanted to read one stream while the other end was only sending a different one. Again, you could have signalling mechanisms so that each end could signal what they'd ideally like to send/receive next - but that makes things even more complicated.

Fundamentally, if you've got two streams of data it makes sense to use two connections.

0

精彩评论

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