Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.3k views
in Java FTP by (220 points)
Hi,

I am using the FTPProgressMonitor interface. I am logging the percentage and bytes transferred into a table in the Oracle database.

Issue is that after 100% bytes are transferred, the following exception is occuring:

java.io.InterruptedIOException: Read timed out
        at java.net.SocketInputStream.socketRead(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.InputStreamReader.fill(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.BufferedReader.fill(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:800)
        at com.enterprisedt.net.ftp.FTPClient.validateTransfer(FTPClient.java:1812)
        at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1786)
        at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1758)
        at TPFTPHandler.downldToImc(TPFTPHandler.java:327)
        at TPFTPHandler.startFirmwareUpload(TPFTPHandler.java:1014)
        at TPFTPDaemon.processRawMessage(TPFTPDaemon.java:74)
        at TPFTPDaemon.waitForFTP(TPFTPDaemon.java:99)
        at TPFTPDaemon.Start(TPFTPDaemon.java:27)
        at TPFTPDaemon.main(TPFTPDaemon.java:15)


This is the bytesTransferred() method I have implemented

public void bytesTransferred( long bytes )
    {
      int perct;
      int b;
      
      percentage = ((double)bytes / (double)fileSize)*100;
        try {
        b = (int)bytes;
        perct = (int)percentage;
        System.out.println("perct= " + perct + " bytes= " + b);
                    
        gcs = new GetClockState(address);

                     // Log the percentage and bytes transferred into a table
                    int ret = gcs.updateFirmwareSize(sessid, perct, fileSize, b);
       }
      catch(java.sql.SQLException rt) {
      rt.printStackTrace();
      }
      
      if((int)percentage == 100) {
          System.out.println("Closing database connection");
          gcs.closeConn();
       }
  System.out.println("Done..");
}


In the above code, after 100% bytes are transferred, the "Done.." message is printed on the screen and I am getting the "java.io.InterruptedIOException: Read timed out" exception.

How to solve this issue?

Thanks
Shar

Please log in or register to answer this question.

Categories

...