转自
http://www.diybl.com/course/3_program/java/javajs/20100719/453294.html
小心弹出窗口Ad
需要重写几个地方
i. org.apache.commons.net.SocketClient
/** 用来自定义 Passive 模式的 Host */
protected String _set_passive_host = "127.0.0.1";
/**
* Opens a Socket connected to a remote host at the specified port and
* originating from the current host at a system assigned port.
* Before returning, {@link #_connectAction_ _connectAction_() }
* is called to perform connection initialization actions.
* <p>
* @param hostname The name of the remote host.
* @param port The port to connect to on the remote host.
* @exception SocketException If the socket timeout could not be set.
* @exception IOException If the socket could not be opened. In most
* cases you will only want to catch IOException since SocketException is
* derived from it.
* @exception UnknownHostException If the hostname cannot be resolved.
*/
public void connect(String hostname, int port)
throws SocketException, IOException
{
// 将连接的hostname赋给_set_passive_host
_set_passive_host = InetAddress.getByName(hostname).getHostAddress();
_socket_= _socketFactory_.createSocket();
_socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
_connectAction_();
}
ii. org.apache.commons.net.ftp.FTPClient
private void __parsePassiveModeReply(String reply)
throws MalformedServerReplyException
{
java.util.regex.Matcher m = __parms_pat.matcher(reply);
if (!m.find()) {
throw new MalformedServerReplyException(
"Could not parse passive host information.\nServer Reply: " + reply);
}
reply = m.group();
String parts[] = m.group().split(",");
//__passiveHost = parts[0] + '.' + parts[1] + '.' + parts[2] + '.' + parts[3];
// 此处将_set_passive_host赋给__passiveHost
__passiveHost = _set_passive_host;
System.out.println(">----------->> Real Host IP is : "+__passiveHost);
try
{
int oct1 = Integer.parseInt(parts[4]);
int oct2 = Integer.parseInt(parts[5]);
__passivePort = (oct1 << 8) | oct2;
}
catch (NumberFormatException e)
{
throw new MalformedServerReplyException(
"Could not parse passive host information.\nServer Reply: " + reply);
}
}
分享到:
相关推荐
ftp服务器如果是主动模式,下载方法与被动模式有很大差异,本案例提供主动模式下载方案
How to set the ftp sever to passive mode in Solaris 10
Li-2015-Metascreen-based-acoustic-passive-p(1)
default-passive-events 当支持EventListenerOptions时,默认使{passive:true} 50行代码段,默认情况下启用某些事件的()。 基本上,每次您声明新的时,它都会自动设置{Passive:true} 。 安装 yarn add default...
构建了一个ftp服务器,通过命令ftp可登录,登录后,无法下载,上传,ls也无法执行。 通过 passive 开启和关闭 PASV模式,再ls 也是同样的问题, # 主动模式 $ pftp -v -A -d 211.159.185.xxx Connected to 211...
AEC - Q200 Stress Test Qualification For Passive Components.zip
(5)Port和Passive 2、WinInet的中FTP的基本操作 (1)头文件 (2)打开连接和关闭 (3)CFtpConnection的操作函数 三、完成进度-----------------------------------------5 1、已完成部分 2、未完成部分 3、还需...
The authors have built the first 3D, kneed, two-legged passive-dynamic walking machine. Since the work of T. McGeer (1990, 1991), the concept of passive dynamics has added insight into animal ...
IEC 62077-2022 Fibre optic interconnecting devices and passive components - Fibre optic circulators - Generic specification.pdf
自己写的一个网络课程设计-FTP客户端程序,实现本地文件浏览和服务器端文件浏览、上传和下载、用户FTP和匿名FTP登陆、ASCII和Binary传输模式、Port和Passive连接模式,包括源程序和设计报告,有详细代码解释
在防火墙后面工作的 FTP 客户端通常使用被动模式 FTP 连接到服务器,以避免防火墙出现问题。 MATLAB 的 ftp 对象没有被动模式功能。 附加文件修改此 MATLAB 类以允许此功能。 这些文件仅使用 MATLAB 使用的 ...
Passive Event Listeners - 被动事件监听器在写webapp页面的时候,Chrome 提醒 [Violat
Gigabit-capable passive optical networks (G-PON) have a large and increasing base of support among telecommunications operators around the world. Written by two of the experts in the field, this book ...
新版完整标准 BS EN IEC 62037-5-2021 Measurement of passive intermodulation in filters.pdf
Underwater Bearings-Only Passive Target Tracking Using Estimate Fusion Technique D.V.A.N. Ravi Kumar 1*, S. Koteswara Rao2 and K. Padma Raju3
max_clients=Number 如果以standalone模式起动,那么只有$Number个用户可以连接,其他的用户将得到错误信息,默认是0不限止 message_file 设置访问一个目录时获得的目录信息文件的文件名,默认是.message 没发现...
关于光接入技术的下一代PON(无源光网络),主要讲WDM-PON,作者是Josep Prat
--no-passive-ftp disable the "passive" transfer mode. --retr-symlinks when recursing, get linked-to files (not dir). --preserve-permissions preserve remote file permissions. Recursive download: -...
FTP是一种文件传输协议,它支持两种模式,一种方式叫做Standard (也就是Active,主动方式),一种是 Passive (也就是PASV,被动方式)。 Standard模式 FTP 的客户端发送 PORT 命令到FTP server。Passive模式FTP的客户端...
common-mode voltage from the motor terminals. Hence, no dielectric breakdown occurs in the grease films, so that no EDM current flows in the bearings. Experimental results verify the viability and ...