Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.1k views
in Java FTP by (120 points)
Hello all.

I'm trying to execute a FTPClient.dirDetails(".") command, but, sometimes, I get this SocketException:

java.net.SocketException: Connection reset
   at java.net.SocketInputStream.read(SocketInputStream.java:194)
   at java.net.SocketInputStream.read(SocketInputStream.java:113)
   at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:324)
   at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:222)
   at java.io.InputStreamReader.read(InputStreamReader.java:207)
   at java.io.BufferedReader.fill(BufferedReader.java:152)
   at java.io.BufferedReader.readLine(BufferedReader.java(Compiled Code))
   at java.io.BufferedReader.readLine(BufferedReader.java:378)
   at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:681)
   at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:649)
   at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:514)
   at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketActive(FTPControlSocket.java:431)
   at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:398)
   at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:2036)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:2002)
   at Test_Java1.main(Test_Java1.java:37)


I tried FTPClient.dir(".") too, with identical results.

I can't find any answers for this problems, so any help tips would be appreciated.

Thankyou for your answers and your time.


Silverfox


- System: AIX
- My program does intense use of this methods
- My edtFTPj library: last version


CODE:
      FTPClient ftp= new FTPClient();
      FTPFile s[]=null;
      
      try{ 
         FTPFileFactory fileFactory = new FTPFileFactory(new UnixFileParser());
         ftp.setParserLocale(Locale.US); 
         ftp.setFTPFileFactory(fileFactory); 
         ftp.setRemoteHost(hostname);
         ftp.setRemotePort(21);
         ftp.setTimeout(10000);
         ftp.connect();

                  
         if (ftp.connected()){
            ftp.login(log, pass);
            ftp.setConnectMode(FTPConnectMode.ACTIVE);
            ftp.setType(FTPTransferType.BINARY);            
            ftp.chdir(directory);
            System.out.println("now you are in "+ftp.pwd());
            
            ftp.dir(".");

            for (int i=0; i < s.length; i++)
               System.out.println(s[i].getName());
            }
      
   
      } catch (Exception e){
         e.printStackTrace();
      } finally {
         try{
            ftp.quit();
         } catch (Exception e){}
      }

1 Answer

0 votes
by (162k points)
It seems that the FTP server reset the connection, it is unclear why. If you can look in the FTP server logs you might find more information.

Hello all.

I'm trying to execute a FTPClient.dirDetails(".") command, but, sometimes, I get this SocketException:

[code]java.net.SocketException: Connection reset

Categories

...