I want to send and receive multiple request/response using Single conection of HttpsURLConnection.
but when i try using single connection for second request it gives me exception java.net.ProtocolException: Cannot write output after reading input please help me....
I remember having similar problems with HttpsURLConnection once, the thing is to get output from HttpsURLConnection, you have to first write things that you need to output stream, close it(!), and then start reading input stream. I don't know how to make multiple requests and responses though, my wild guess is that you could play with keepAlive parameter, or just use some kind of connection caching framework.
I know very little about this subject so feel free to correct me. One of the first lines of the javadoc of HttpURLConnection is:
Each HttpURLConnection instance is used to make a single request but the underlying network connection to the HTTP server may be transparently shared by other instances.
So it's not intended to be used that way.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.