Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.5k views
in Java FTP by
Do you have rational Values for the timeout? [ setTimeout(int timeout) ]
With very small values ~ 1 msec I get an Exception (obvioulsy).
I tried 1000 but sometimes get the read timeout exception and sometimes not.
What do you suggest to use for the timeout value? 10 sec? 1 minute? The documentaion does not mention it.

Another question: Does the timeout happen when downloading a very big file, too? E.g. transmission of an 1GB file would take more then 10 seconds.

Thanks in advance.

6 Answers

0 votes
by (162k points)
Timeout shouldn't be set generally but the Java default used (no timeout).

Timeout is during a read or write, i.e. if there is a delay on the socket read/write. It is irrelevant how long it takes to transfer the file. See the java.io.Socket Javadoc for more info.

Do you have rational Values for the timeout? [ setTimeout(int timeout) ]
With very small values ~ 1 msec I get an Exception (obvioulsy).
I tried 1000 but sometimes get the read timeout exception and sometimes not.
What do you suggest to use for the timeout value? 10 sec? 1 minute? The documentaion does not mention it.

Another question: Does the timeout happen when downloading a very big file, too? E.g. transmission of an 1GB file would take more then 10 seconds.

Thanks in advance.
0 votes
by
Thanks for the quick reply.

Regarding the timeout value: if I use no timeout the socket would block forever which is probably not a good idea for a server process.
It would be great to have a default value for the timeout where one safely assumes that the server will not reply any more (hangs).


Timeout shouldn't be set generally but the Java default used (no timeout).

0 votes
by (162k points)
30 seconds is reasonable, i.e. 30000 (as it is in milliseconds)

Thanks for the quick reply.

Regarding the timeout value: if I use no timeout the socket would block forever which is probably not a good idea for a server process.
It would be great to have a default value for the timeout where one safely assumes that the server will not reply any more (hangs).


Timeout shouldn't be set generally but the Java default used (no timeout).

0 votes
by
Thank you very much !
Rainer


30 seconds is reasonable, i.e. 30000 (as it is in milliseconds)
0 votes
by
I'm using the FTPj library in my code, and it usually works well. I have not set a timeout value, but sometimes I see this error message:
com.enterprisedt.net.ftp.FTPException: Timeout (900 seconds): closing control co nnection.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSoc
ket.java:689)
at com.enterprisedt.net.ftp.FTPClient.modtime(FTPClient.java:2109)

Is there a default timeout in FTPj?

Another question I have is that is it possible to query the size of the remote file?
0 votes
by (162k points)
This is the FTP server timeout.

Use size() or dirDetails() to find the size of a file.

I'm using the FTPj library in my code, and it usually works well. I have not set a timeout value, but sometimes I see this error message:
com.enterprisedt.net.ftp.FTPException: Timeout (900 seconds): closing control co nnection.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSoc
ket.java:689)
at com.enterprisedt.net.ftp.FTPClient.modtime(FTPClient.java:2109)

Is there a default timeout in FTPj?

Another question I have is that is it possible to query the size of the remote file?

Categories

...