R
Ravi Ambros Wallau
Hi:
I'm developing an application that should make a serie of requests,
using the POST method and transfering binary data, to our HTTP server.
If I use the method Connector.open(url), and then call the methods
openDataOutputStream() and openDataInputStream, everything works fine.
But, when making multiple calls, I'm sure that this is not the best
way to do that.
I've tryed to use the keep-alive feature of http connections, but I
really can't figure how. I've tryed something like this:
HttpConnection hc = (HttpConnection)Connector.open(url);
... set headers
DataOutputStream out = hc.openDataOutputStream();
out.write(...);
out.flush();
out.close();
DataInputStream in = hc.openDataInputStream();
in.read();
... Cycle is finalized - now, if I make this:
out.write(...);
out.flush();
out.close();
... or this:
out = hc.openDataOutputStream();
I receive an IOException with the message "Connection is already
open".
I'm looking for some help on Internet (using google), but there are
few articles about the topics I'm searching for.
Thanks,
Ravi.
I'm developing an application that should make a serie of requests,
using the POST method and transfering binary data, to our HTTP server.
If I use the method Connector.open(url), and then call the methods
openDataOutputStream() and openDataInputStream, everything works fine.
But, when making multiple calls, I'm sure that this is not the best
way to do that.
I've tryed to use the keep-alive feature of http connections, but I
really can't figure how. I've tryed something like this:
HttpConnection hc = (HttpConnection)Connector.open(url);
... set headers
DataOutputStream out = hc.openDataOutputStream();
out.write(...);
out.flush();
out.close();
DataInputStream in = hc.openDataInputStream();
in.read();
... Cycle is finalized - now, if I make this:
out.write(...);
out.flush();
out.close();
... or this:
out = hc.openDataOutputStream();
I receive an IOException with the message "Connection is already
open".
I'm looking for some help on Internet (using google), but there are
few articles about the topics I'm searching for.
Thanks,
Ravi.