Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.9k views
in Java FTP by
[version edtftpj 1.5.1]

i

9 Answers

0 votes
by (162k points)
Can you post the log file demonstrating what is happening?
0 votes
by
first the log of the ftp-server
230 Logged on
TYPE I
200 Type set to I
PASV
227 Entering Passive Mode (127,0,0,1,6,4)
RETR foobar.tmp
150 Connection accepted
421 Kicked by Administrator
disconnected


my programm looks like this
    public void run() {
        try {
            out   = new OutputStream(new FileOutputStream(/test.tmp));
            ftp.connect();
            
            ftp.login(user, password);
            
            ftp.setType(FTPTransferType.BINARY);
            ftp.setTransferBufferSize(8388608);
            ftp.setConnectMode(FTPConnectMode.PASV);
            ftp.setTimeout(10*1000);

            //do the transfer
            ftp.get(out, filename);

            //cleanup
            ftp.setType(FTPTransferType.ASCII);
        } catch (IOException e) {
        } catch (FTPException e) {
        } finally {
            try {
                ftp.quit();                        
            } catch (IOException e1) {
            } catch (FTPException e1) {
            } finally {
                try {
                    out.close();
                } catch (IOException e2) {}    
            }



if i kick my programm from the ftp-server, as shown in the log
i get an Socketexception that looks like this

java.net.SocketException: Software caused connection abort: socket write error
   at java.net.SocketOutputStream.socketWrite0(Native Method)
   at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java(Compiled Code))
   at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code))
   at com.enterprisedt.net.ftp.FTPClient.putData(FTPClient.java:1506)
   at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1264)
   at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1228)
   at MyTest.run(DMAeEDIPut.java:111)
0 votes
by
i noticed that i posted the wrong logfiles, since
i described my problem with the input-stream.
but the programm ,logs and problems are identical
so don
0 votes
by
here are the debug log messages from edtFTPj

Starting Threads
DEBUG [com.enterprisedt.net.ftp.FTPClient] 24 Okt 2005 13:46:18.589 : Connecting to /127.0.0.1:21
DEBUG [com.enterprisedt.net.ftp.FTPClient] 24 Okt 2005 13:46:18.589 : Connecting to /127.0.0.1:21
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : 220 Welcome to Elmi?s tiny testserver
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : ---> USER elmi
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : 331 Password required for elmi
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : ---> PASS ********
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : 230 Logged on
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.599 : ---> TYPE I
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.609 : 200 Type set to I
GET started
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.609 : ---> PASV
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.609 : 227 Entering Passive Mode (127,0,0,1,7,72)
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.609 : ---> RETR test500.tmp
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.609 : 150 Connection accepted
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : 220 Welcome to Elmi?s tiny testserver
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : ---> USER elmi
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : 331 Password required for elmi
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : ---> PASS ********
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : 230 Logged on
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:18.759 : ---> TYPE I
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:19.29 : 200 Type set to I
PUT started
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:19.29 : ---> PASV
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:19.29 : 227 Entering Passive Mode (127,0,0,1,7,74)
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:19.39 : ---> STOR foobar.tmp
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:19.39 : 150 Connection accepted
GET: IOException found
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:23.185 : ---> QUIT
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:23.185 : 426 Connection closed; transfer aborted.
DEBUG [com.enterprisedt.net.ftp.FTPClient] 24 Okt 2005 13:46:23.205 : Transferred 80871424 bytes to remote host
PUT: IOException found
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 24 Okt 2005 13:46:23.205 : ---> QUIT
0 votes
by
ok i think i found the answer to my problem myself
the put method (put(InputStream srcStream, String remoteFile))
didn
0 votes
by (162k points)
If you read the code carefully you will find every put/get method calls validateTransfer().

Why don't you just catch IOException in your own code & use getLastValidReply() instead of modifying the library?

every get method and all of the put appender methods execute the
validateTransfer method in the end to check if there might have
been a problem with the FTPserver or if the Transfer was successful.

The other put methods don
0 votes
by
You
0 votes
by (162k points)
By design. If an IOException is thrown, QuitImmediately() should be called and no other operations attempted. Calling validateTransfer() when the transfer failed doesn't really make sense. You're just lucky that in your case it works.

But there
0 votes
by
your

Categories

...