common-net ftp封装
?
好像这个版本的不支持设置连接超时,所以重写了个
?
class FTPClient extends org.apache.commons.net.ftp.FTPClient{private SocketFactory _socketFactory_=SocketFactory.getDefault();private int timeOut = 2000;public FTPClient(){} public void connect(InetAddress host, int port) throws SocketException, IOException { _socket_=this._socketFactory_.createSocket(); _socket_.connect(new InetSocketAddress(host, port), timeOut); _connectAction_(); } public void connect(String hostname, int port) throws SocketException, IOException { connect(InetAddress.getByName(hostname), port); } public void setConnTimeOut(int timeOut){ }public int getTimeOut() {return timeOut;}public void setTimeOut(int timeOut) {this.timeOut = timeOut;}}?