通过 3g 的 ftpclient [英] ftpclient via 3g

查看:25
本文介绍了通过 3g 的 ftpclient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Apache Commons ftp 客户端将文件上传到服务器.如果我的家用路由器有 Wi-Fi 连接,一切顺利.如果我没有那个 wi-fi 连接,3G 图标会出现在通知栏中,但 ftp.connect 会给出错误连接重置由对等方".我已经用谷歌搜索了这个,但没有找到任何有帮助的东西.ftpclient 不能使用 3G 吗?

I am using Apache Commons ftp client to upload a file to a server. If I have a wi-fi connection to my home router all goes well. If I dont have that wi-fi connection the 3G icon appears in the notification bar but the ftp.connect gives an error 'connection reset by peer'. I've googled around for this but not found anything that helps. Is ftpclient not able to work with 3G?

推荐答案

常规 FTP 文件传输(在主动模式下)使用两个连接 - 一个由客户端建立,另一个从服务器建立用于传输数据.由于 3G 连接通常受到 NAT 系统的防火墙保护,因此服务器无法访问客户端.因此,只能在被动模式下进行连接.

A regular FTP file transfer (in active mode) uses two connections - one established by the client and one established from the server for transferring the data. As 3G connections are usually firewalled by a NAT system the server can not reach the client. Therefore only connections in passive mode are possible.

您是否尝试过使用被动模式.它应该可以通过在 FtpClient 实例.

Have you tried to use the passive mode. It should be configurable by calling enterLocalPassiveMode() on the FtpClient instance.

这篇关于通过 3g 的 ftpclient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆