Image Stream Sent Over Socket - Server Deadlock Issue
Solution 1:
You're not closing the networkOutputStream
, so the C++ code doesn't know you're finished.
Either you need to close the output stream - which is only viable if you don't need to send any more data on it, obviously - or you need to include some metadata in the protocol to either indicate before you start writing how much more data there is, or include something afterwards as a "done" indicator. Generally I prefer a length prefix - it's much simpler than having to worry about escaping if the "done" indicator appears naturally in data.
A half-way house is to repeatedly say "here's a chunk of data length X" and then an "I'm done, no more chunks" message (which could be "here's a chunk of data length 0" for example). This way you don't need to know the total length beforehand.
Post a Comment for "Image Stream Sent Over Socket - Server Deadlock Issue"