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.
精彩评论