“426写入网络流失败。”尝试使用 Java 的 URL 类连接到 FTP 站点时收到
我有一些 Java 代码,大致如下所示:
String urlString = "ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.glo_30m.dp.200601.grb2";
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
当我到达最后一行时,代码挂起并且永远不会返回。当我附加 Wireshark 并查看对话时,它的结尾如下:
...
EPSV ALL
200 EPSV ALL ok.
EPSV
229 Entering Extended Passive Mode (|||32647|)
EPRT |1|144.212.217.249|58416|
200 EPRT command successful. Consider using EPSV.
RETR multi_1.glo_30m.dp.200601.grb2
150 Opening BINARY mode data connection for multi_1.glo_30m.dp.200601.grb2 (55796622 bytes).
426 Failure writing network stream.
此 URL 在我的浏览器中运行良好。其他网站可以正常使用此 Java 代码。你有什么想法为什么这个组合会遇到麻烦吗?
I have some Java code which looks roughly like this:
String urlString = "ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.glo_30m.dp.200601.grb2";
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
When I get to the last line, the code hangs and never returns. When I attach Wireshark and look at the conversation, it ends like this:
...
EPSV ALL
200 EPSV ALL ok.
EPSV
229 Entering Extended Passive Mode (|||32647|)
EPRT |1|144.212.217.249|58416|
200 EPRT command successful. Consider using EPSV.
RETR multi_1.glo_30m.dp.200601.grb2
150 Opening BINARY mode data connection for multi_1.glo_30m.dp.200601.grb2 (55796622 bytes).
426 Failure writing network stream.
This URL works fine in my browser. Other sites work fine with this Java code. Any ideas why this combination is having trouble?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是 Sun 实现中的一个错误。我已在这里报告:
https://bugs.java.com/bugdatabase/view_bug ?bug_id=7148208
This is likely a bug in Sun's implementation. I've reported it here:
https://bugs.java.com/bugdatabase/view_bug?bug_id=7148208