Dear everyone,

I use a servlet for transferring files from client to
server. The client calls the servlet using URLConnection.
Then it gets the output stream using URLConnection.get-
OutputStream() - and then send the file to be transferred
using this stream. You get the idea! (Please see the code
below.)

This works fine 99% of the time. Sometimes it fails this way:
The call URLConnection.getOutputStream() throws this exception:
java.net.BindException: Address already in use: connect

Even here, it doesn't have any trouble getting the URLConnection,
though. And this problem happens only 1% of the time.

Anyone have any clues about this problem? I am baffled about
why a client while calling a servlet would try to bind to a
port.

Thanks a lot in advance for your help!
George

codes:

         URL serverURL = new URL(servletURL);
         URLConnection serverCon = serverURL.openConnection();

         // a bunch of connection setup related things.
         serverCon.setDoInput(true);
         serverCon.setDoOutput(true);

         // Don't use a cached version of URL connection.
         serverCon.setUseCaches (false);
         serverCon.setDefaultUseCaches (false);

         // set headers and their values.
         serverCon.setRequestProperty("Content-Type",
                                      "application/octet-stream");

         // create file stream and write stream to write file data.
         FileInputStream fis = new FileInputStream(fileToUpload);
         OutputStream os = serverCon.getOutputStream();

         // transfer the file in byte chunks...




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to