> -----Original Message-----
> From: sebb [mailto:[email protected]] 
> Sent: Sunday, March 13, 2011 10:04 AM
> To: Commons Users List
> Subject: Re: [NET]FTPSClient listFiles() throw 
> SocketException when current directory's file is null.
> 
> On 12 March 2011 10:42, chenxuejie <[email protected]> wrote:
> > Hi All.
> >
> >  I use FTPSClient to list FTP server's directory.
> >  When FTP server's directory contains file, FTPSClient.listFiles() 
> > execute correctly.
> >  But, when FTP server's directory  do not contains any file. it 
> > allways throw exception.
> 
> Which version of NET are you using?
I use WinFTP Server for testing.
May be it is WinFTP Server's problem. 
When I use freeFTPd server, the exception didn't occur.

> 
> What is the exact Exception thrown?
javax.net.ssl.SSLHandshakeException: Remote host closed connection during
handshake
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:801
)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocket
Impl.java:1089)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java
:1116)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java
:1100)
        at
com.nec.webotx.jbi.org.apache.commons.net.ftp.FTPSClient._openDataConnection
_(FTPSClient.java:537)
        at
com.nec.webotx.jbi.org.apache.commons.net.ftp.FTPClient.initiateListParsing(
FTPClient.java:2545)
        at
com.nec.webotx.jbi.org.apache.commons.net.ftp.FTPClient.initiateListParsing(
FTPClient.java:2519)
        at
com.nec.webotx.jbi.org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.
java:2276)
        at
com.nec.webotx.jbi.org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.
java:2322)
        at FTPSExample.main(FTPSExample.java:104)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at
com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:782
)


> 
> >  My example code as follows.
> >  static void main(String[] args){
> >
> >  FTPSClient client = new FTPSClient();
> >  //start to set KeyManager and TrustManager
> >  .....
> >  client .setKeyManager(kmf.getKeyManagers()[0]);
> >  client .setTrustManager(tmf.getTrustManagers()[0]);
> >  //end set KeyManager and TrustManager
> >
> >  client .connect(localhost, 21);
> >  client .login(guest,guest);
> >  client .execPROT("P");
> >  client .execPBSZ(0);
> >  client .pwd();
> >  client .pasv();
> >  client .listFiles();
> >  }
> >
> >  Xuejie.Chen
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to