读书人

common-net ftp打包

发布时间: 2012-09-22 21:54:54 作者: rapoo

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;}}

?

读书人网 >编程

热点推荐