Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.8k views
in Java FTP by
How can I know in my program if the connection was aborted by FTP server? For example, if the timeout finishs, how can I know this?

Jorge

5 Answers

0 votes
by (162k points)
A java.net.SocketTimeoutException will be trhown (subclass of IOException)

Bruce Blackshaw
EDT Support

How can I know in my program if the connection was aborted by FTP server? For example, if the timeout finishs, how can I know this?

Jorge
0 votes
by
Don't forget that FTP Servers may still answer and let you know that your session has timed out.
You wouldn't get a SocketTimeoutException in this case:

com.enterprisedt.net.ftp.FTPException: Timeout. Pay attention.
at
com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:5
72)
at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketPASV(FTPControlSocket
.java:385)

at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.jav
a:293)
at com.enterprisedt.net.ftp.FTPClient.initGet(FTPClient.java:1067)




A java.net.SocketTimeoutException will be trhown (subclass of IOException)

Bruce Blackshaw
EDT Support

How can I know in my program if the connection was aborted by FTP server? For example, if the timeout finishs, how can I know this?

Jorge
0 votes
by (162k points)
Yes - if your session with the FTP server has timed out, you'll get an FTPException on the next operation. Thanks.

Don't forget that FTP Servers may still answer and let you know that your session has timed out.
You wouldn't get a SocketTimeoutException in this case:
0 votes
by
Yes - if your session with the FTP server has timed out, you'll get an FTPException on the next operation. Thanks.

Don't forget that FTP Servers may still answer and let you know that your session has timed out.
You wouldn't get a SocketTimeoutException in this case:

and what I can to do for the renew connection?
0 votes
by (162k points)
You'll have to log in again.

Note you can call NoOp() to prevent the server timing you out.

and what I can to do for the renew connection?

Categories

...