I am using the HttpURLConnection class to make my http requests to get
data and I am noticing that some OS tools show my app as remaining in
a CLOSE_WAIT status no matter how long I wait.  Here is a sample of
the code I use to make the request,

            URL url = new URL(strURL);
            URLConnection connection = url.openConnection();
            HttpURLConnection httpConnection =
(HttpURLConnection)connection;
            httpConnection.setDoInput(true);
            httpConnection.setDoOutput(true);
            httpConnection.setUseCaches(false);
            httpConnection.setRequestMethod(GET);

            int responsecode = httpConnection.getResponseCode();
            if (responsecode == HttpURLConnection.HTTP_OK) {
                InputStream in = httpConnection.getInputStream();

                byte[] buffer = new byte[bufSize];
                int bufSize = 8192;
                int length = bufSize;
                while (length != -1) {
                    // keep reading until we get -1 returned...
                    length = in.read(buffer, 0, bufSize);
                }
            }

            in.close();
            httpConnection.disconnect();


Is this a known issue with the platform or am I missing a step in
closing the connection?

Thanks, Mark

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to