posted 18 years ago
Found the following replies to a similar question on Sun's discussion forum:
You have to open a new connection for every new HTTP request. Since HTTP is strongly request-response based, you cant write anything to the output stream after you have opened the input stream (wrote request, read response and finish).
You cant reuse the existing connection in HTTP. Of course a socket connection can do this ;-)
hth
-Kay
The HttpConnection object is a "use and throw" object. It works for one sending of the HTTP request, and then receiving the response. That is why once you've opened the input stream you can't write to the output stream. It's already been flushed and closed. But the phone will keep your GPRS connection open. So you can send more requests without the need to to reopen the GPRS link.
-Shmoove
[ June 01, 2005: Message edited by: Danish Shaukat ]