I communicate with the server, and ideally I would like the input stream and the output stream to always go up. I get unsolicited answers, so I should always be ready to receive data on the input stream.
Before I dive into much more, I must say that any connection I make must support SSL.
The problem I am facing is when I open the HttpUrLConnection and send stuff from the output stream, it will not send the actual output until I open the input stream. If I open the input stream, it kills the output stream, and it seems that there is no need to restore it after closing the stream.
What would be the best way to realize my desired behavior? If it is not possible to support both streams simultaneously on the same port, is there a way I could have two separate streams that share a connection through a kind of port lock / switch?
Is there a library to send output without killing the output stream to signal the completion of my request?
source share