简体   繁体   中英

java.net.SocketException: recvfrom failed: ECONNRESET

What does this warning mean? Here is my code for that snippet,

public static Bitmap downloadBitmap(String url) {
    if (reachable()) {
        HttpEntity entity = null;
        Log.i("DLB URL", url);
        HttpClient client = new DefaultHttpClient();
        HttpGet getRequest = new HttpGet(url);
        try {
            HttpResponse response = client.execute(getRequest);
            final int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != HttpStatus.SC_OK) {
                return null;
            }
            entity = response.getEntity();
            if (entity != null) {
                InputStream inputStream = null;
                try {
                    System.setProperty("http.keepAlive", "false");
                    inputStream = entity.getContent();
                    final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);

                    return bitmap;

                } finally {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
        } catch (Exception e) {
            Log.i("ABORT", e.toString());
            getRequest.abort();
        }
    }
    return null;
}

the warning is poiting at the decodeStream line but i've no idea what this does. on a search i found something probable but i don't have a worker thread so i don't understand. thank you.

No problem at all. Was just a warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM