Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in Java FTP by (162k points)
A user writes:
Hi,

I'm using the edtFTPj/Free API to upload files to the FTP server.

My configuration details are as below:

TimeOut: 10000 ms
Binary mode of transfer
Connect mode : Passive

With the above configuration, if I try to upload the files(around 1000) continuously to the FTPserver(a new connection will be made for each file transfer), while uploading some of the files( though they are very small in size like 1 KB), program is throwing the exception : java.net.SocketTimeoutException: Accept timed out.

The same behavior is shown when the connect mode is changed to ACTIVE mode as well.

I also tried by setting the timeout to "0". In this case, as I'm using directory listing in the program, uploading process is hanged after uploading some messages( for eg: after processing 10 messages sometimes and after processing 130 messages sometimes) at the point where code is executing the directory listing command.( Same is the case with directory listing and directory name listing).

Can anyone please help me how to overcome this problem?


Try setting the timeout to 120,000 (which is 120s). 10s is too low.

You are also running into the problem of too many sockets being used. You may need to slow down transfers of very small files (which allows sockets to be freed up by the operating system).

2 Answers

0 votes
by (140 points)
Hi Bruce,

Many thanks for the quick response.

I tried by setting 120ms as suggested, below is my analysis after changing the value -

Please have a look into the time details at which the exception is occurred while processing 1000 messages with the timeout of 10000ms --

JMSTimestamp 2010-10-29 11:56:28.928 +0530
JMSTimestamp 2010-10-29 11:57:45.353 +0530
JMSTimestamp 2010-10-29 11:58:17.138 +0530
JMSTimestamp 2010-10-29 11:59:01.164 +0530
JMSTimestamp 2010-10-29 11:59:45.753 +0530
JMSTimestamp 2010-10-29 12:00:27.843 +0530
JMSTimestamp 2010-10-29 12:00:39.949 +0530
JMSTimestamp 2010-10-29 12:01:07.264 +0530

Please have a look into the time details at which the exception is occurred while processing 1000 messages with the timeout of 120000ms --

JMSTimestamp 2010-10-29 12:16:18.444 +0530
JMSTimestamp 2010-10-29 12:20:22.169 +0530
JMSTimestamp 2010-10-29 12:23:07.563 +0530

By looking the above details, I observed that the message processing is happening for the amount of time mentioned in time-out and being hanged for the time mentioned in time-out property in the code at the point where directory listing is happneing. After hanging for amount of time-out period an exception message is thrown "java.net.SocketTimeoutException: Accept timed out".

Please correct me if my analysis is wrong and suggest me how to solve this problem?

Thanks and Regards
aparnmu
0 votes
by (162k points)
A new connection for each transfer is going to run into problems with 1000 transfers of small files - you will run out of sockets on the client and possibly the server.

Can you do the transfers with one connection? That will help.

Categories

...