2

phonegap でダウンロード ファイル転送のタイムアウトを定義する方法はありますか。Android デバイスで、応答しない URL をダウンロードしようとすると、8 分後に次のメッセージが表示されます。

02-05 11:50:38.234 W/FileTransfer(12658): Error getting HTTP status code from connection.
02-05 11:50:38.234 W/FileTransfer(12658): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:552)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.IoBridge.recvfrom(IoBridge.java:516)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.io.InputStream.read(InputStream.java:163)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.Streams.readAsciiLine(Streams.java:201)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
02-05 11:50:38.234 W/FileTransfer(12658):   at org.apache.cordova.FileTransfer.download(FileTransfer.java:495)
02-05 11:50:38.234 W/FileTransfer(12658):   at org.apache.cordova.FileTransfer.execute(FileTransfer.java:88)
02-05 11:50:38.234 W/FileTransfer(12658):   at org.apache.cordova.api.PluginManager$1.run(PluginManager.java:231)
02-05 11:50:38.234 W/FileTransfer(12658):   at java.lang.Thread.run(Thread.java:856)
02-05 11:50:38.234 W/FileTransfer(12658): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.Posix.recvfromBytes(Native Method)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.Posix.recvfrom(Posix.java:131)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
02-05 11:50:38.234 W/FileTransfer(12658):   at libcore.io.IoBridge.recvfrom(IoBridge.java:513)
02-05 11:50:38.234 W/FileTransfer(12658):   ... 15 more
02-05 11:50:38.234 E/FileTransfer(12658): {"target":"\/storage\/sdcard0\/Android\/data\/uk.ac.edina.mobile\/cache\/edina\/cache\/open_3_21_37.jpg","source":"http:\/\/fieldtripgb.edina.ac.uk\/mapcache\/tms1.0.0\/fieldtripgb@BNG\/3\/21\/37.jpg?version=1.1.1&id=22362b279a637a91&app=free&cache=true","code":3}
02-05 11:50:38.234 E/FileTransfer(12658): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:552)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.IoBridge.recvfrom(IoBridge.java:516)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.io.InputStream.read(InputStream.java:163)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.Streams.readAsciiLine(Streams.java:201)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
02-05 11:50:38.234 E/FileTransfer(12658):   at org.apache.cordova.FileTransfer.download(FileTransfer.java:495)
02-05 11:50:38.234 E/FileTransfer(12658):   at org.apache.cordova.FileTransfer.execute(FileTransfer.java:88)
02-05 11:50:38.234 E/FileTransfer(12658):   at org.apache.cordova.api.PluginManager$1.run(PluginManager.java:231)
02-05 11:50:38.234 E/FileTransfer(12658):   at java.lang.Thread.run(Thread.java:856)
02-05 11:50:38.234 E/FileTransfer(12658): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.Posix.recvfromBytes(Native Method)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.Posix.recvfrom(Posix.java:131)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
02-05 11:50:38.234 E/FileTransfer(12658):   at libcore.io.IoBridge.recvfrom(IoBridge.java:513)
02-05 11:50:38.234 E/FileTransfer(12658):   ... 15 more
4

4 に答える 4

1

いいえ、機能リクエストですhttps://issues.apache.org/jira/browse/CB-2394

于 2013-02-08T10:42:30.590 に答える
0

チャンクモードオプションを使用してみましたか?

于 2013-02-06T04:49:59.753 に答える
0

機能リクエストのコメントで述べたように、これは abord() を setTimeout() で操作することで実行できます

于 2013-03-19T14:50:25.477 に答える