溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

recvfrom failed: ETIMEDOUT (Connection timed out)

發(fā)布時(shí)間:2020-04-21 06:58:42 來源:網(wǎng)絡(luò) 閱讀:11646 作者:truesea 欄目:開發(fā)技術(shù)

WIFI網(wǎng)絡(luò)和移動(dòng)網(wǎng)絡(luò)同時(shí)打開,在下載過程中,關(guān)閉WIFI網(wǎng)絡(luò),此時(shí)系統(tǒng)關(guān)閉WIFI網(wǎng)絡(luò)同時(shí)切換到移動(dòng)網(wǎng)絡(luò),在此過程,出現(xiàn)以下異常,出現(xiàn)異常的語句是is.read(buffer),代碼段如下:

try{
    while ((len = is.read(buffer)) != -1) {
        if(!CommonUtils.isDownloadAvailable()) {
            Logger.v(TAG, "Download operation is unavailable, stop down.");
            break;
        }
        if(!running) {
            Logger.v(TAG, "Down is cancelled, stop down.");
            break;
        }
        offset += len;
        file.write(buffer, 0, len);
        sendMessage(DownMessage.MSG_UPDATE, len);
    }
}catch(IOException e) {
    Logger.e(TAG, "Catch IO exception when read data from input stream.", e);
    throw e;
}

Catch IO exception when read data from input stream.

java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)

at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:542)

at libcore.io.IoBridge.recvfrom(IoBridge.java:506)

at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)

at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)

at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)

at java.io.BufferedInputStream.read(BufferedInputStream.java:304)

at libcore.net.http.FixedLengthInputStream.read(FixedLengthInputStream.java:45)

at java.io.BufferedInputStream.read(BufferedInputStream.java:304)

at java.io.InputStream.read(InputStream.java:163)

at com.tvie.ivideo.download.logic.DownThread.run(DownThread.java:70)

Caused by: libcore.io.ErrnoException: recvfrom failed: ETIMEDOUT (Connection timed out)

at libcore.io.Posix.recvfromBytes(Native Method)

at libcore.io.Posix.recvfrom(Posix.java:131)

at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)

at libcore.io.IoBridge.recvfrom(IoBridge.java:503)

... 8 more


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI