Topic: :(求救:自己做的一个HTTP文件下载工具。有问题请教高手……

  Print this page

1.:(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… Copy to clipboard
Posted by: Wendy0007
Posted on: 2004-04-02 20:07

在学习java的过程中开发了一个穿过公司防火墙的断点续传的多线程下载工具(公司的防火墙不支持flashget之类的下载工具Sad)。出现了以下问题:下载某些http站点的文件会有问题,见红色文本(正常情况下最后一个线程的StartPos和EndPos应该是一致的)。下载完毕后打开会报错。为什么会这样??我检查过程序没有问题的,是这跟web服务器的设置有关吗???请教高手帮忙……

URL=http://www.servlets.com/cos/cos-27May2002.zip
307080
Thread 0 , nStartPos = 0, nEndPos = 61416
Thread 0 Begin... RANGE : bytes=0-61416
Thread 1 , nStartPos = 61416, nEndPos = 122832
Thread 1 Begin... RANGE : bytes=61416-122832
Thread 2 , nStartPos = 122832, nEndPos = 184248
Thread 3 , nStartPos = 184248, nEndPos = 245664
Thread 4 , nStartPos = 245664, nEndPos = 307080
Thread 2 Begin... RANGE : bytes=122832-184248
Thread 3 Begin... RANGE : bytes=184248-245664
Thread 4 Begin... RANGE : bytes=245664-307080
Thread 1 is over!
Thread 0 is over!
Thread 4 is over!
Thread 2 is over!
Thread 3 is over!
文件下载结束!
Thread 0: StartPos:61512 EndPos:61416 true
Thread 1: StartPos:122940 EndPos:122832 true
Thread 2: StartPos:184780 EndPos:184248 true
Thread 3: StartPos:246208 EndPos:245664 true
Thread 4: StartPos:307612 EndPos:307080 true
Begin at : Fri Apr 02 19:12:02 CST 2004
End at : Fri Apr 02 19:12:16 CST 2004
文件大小:299(K)
下载用时:14秒
下载速度:20(K/S)

2.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: Wendy0007
Posted on: 2004-04-02 20:18

这是能正常下载的一个,下载完毕后最后一段线程的StartPos和EndPos是一致的(红色文本)。

URL=http://ljj.lamost.org/video/6.1.zip
.
.
.
Thread 1 retry(39)... RANGE : bytes=3807935-7034966
java.net.UnknownHostException: ljj.lamost.org
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
  at java.net.Socket.connect(Socket.java:452)
  at java.net.Socket.connect(Socket.java:402)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
  at sun.net.www.http.HttpClient.New(HttpClient.java:339)
  at sun.net.www.http.HttpClient.New(HttpClient.java:320)
  at sun.net.www.http.HttpClient.New(HttpClient.java:315)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)
  at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
  at cn.com.wendy.util.net.FileSplitterFetch.run(FileSplitterFetch.java:64)
Thread 4 retry(40)... RANGE : bytes=14303100-17587419
java.net.UnknownHostException: ljj.lamost.org
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
  at java.net.Socket.connect(Socket.java:452)
  at java.net.Socket.connect(Socket.java:402)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
  at sun.net.www.http.HttpClient.New(HttpClient.java:339)
  at sun.net.www.http.HttpClient.New(HttpClient.java:320)
  at sun.net.www.http.HttpClient.New(HttpClient.java:315)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)
  at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
  at cn.com.wendy.util.net.FileSplitterFetch.run(FileSplitterFetch.java:64)
Thread 2 retry(39)... RANGE : bytes=7173746-10552449
java.net.UnknownHostException: ljj.lamost.org
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
  at java.net.Socket.connect(Socket.java:452)
  at java.net.Socket.connect(Socket.java:402)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
  at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
  at sun.net.www.http.HttpClient.New(HttpClient.java:339)
  at sun.net.www.http.HttpClient.New(HttpClient.java:320)
  at sun.net.www.http.HttpClient.New(HttpClient.java:315)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)
  at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
  at cn.com.wendy.util.net.FileSplitterFetch.run(FileSplitterFetch.java:64)
Thread 3 retry(38)... RANGE : bytes=10825037-14069932
Thread 0 is over!
Thread 2 is over!
Thread 4 is over!
Thread 3 is over!
Thread 1 is over!
文件下载结束!
Thread 0: StartPos:3518142 EndPos:3517483 true
Thread 1: StartPos:7035179 EndPos:7034966 true
Thread 2: StartPos:10553366 EndPos:10552449 true
Thread 3: StartPos:14070553 EndPos:14069932 true
Thread 4: StartPos:17587419 EndPos:17587419 true
Begin at : Fri Apr 02 19:50:04 CST 2004
End at : Fri Apr 02 20:08:39 CST 2004
文件大小:17175(K)
下载用时:1115秒
下载速度:14(K/S)

3.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: Wendy0007
Posted on: 2004-04-02 20:45

还有,从本站下载的文件取不到文件长度信息(从HttpURLConnection中提取)。为什么取不到????
http://www.cjsdn.com/user/download/83707/color4j-20040317-win.zip

4.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: Wendy0007
Posted on: 2004-04-03 23:13

为什么没人理我……
高手都去哪里了???

5.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: rainman
Posted on: 2004-04-04 01:43

故意不支持多线程下载啊。

6.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: floater
Posted on: 2004-04-04 01:49

if you don't post the relevant code and ask why, who will know??

7.Re::(求救:自己做的一个HTTP文件下载工具。有问题请教高手…… [Re: Wendy0007] Copy to clipboard
Posted by: pengtaoli
Posted on: 2004-04-22 10:18

应该把相关代码贴出来,大家可以研究一下问题。
不然可能就无的放矢了。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923