>>> Scholnick Steve <[EMAIL PROTECTED]> 01-Jun-00 3:07:30 PM >>>
>when i first write an object to the URLConnection, it gets sent
>over the wire to the servlet. i then read the return object. when
>i try to write again to the servlet (using the same URLConnection
>object), i get the following error:
> java.net.ProtocolException: Cannot write output after reading
input.
>is there anyway to use the same URLConnection many times for
>doing reading and writing? do i have to create a new instance of
>URLConnection each time for a write/read operation?
Yes.
Unless the server implements HTTP/1.1 persistent connections a new
TCP socket is required for every transaction.
Even if the server uses persistent connections you still have to
create multiple requests and that is why you need mutliple
URLConnection objects.
I can't say whether mutliple objects will support streaming over a
single connection or not (you can look in the source code for
HttpURLConnection in the Java API libraries).
If you have many objects to pass over a link you could collect them
in a vector or a hashtable and serialize that over the link... then
you only need one connection.
Nic Ferrier
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html