0 votes

Hi!

I use (licensed) your FTP component. In my background Worker (I use VBNET), I should make some operations (create pdf and so on) that are time consuming. Often FTP component shows this error:

{"Tried to read a line. No data received. Please make sure that antivirus and firewall software are disabled or configured correctly."}

I think maybe a timeout. I tried KeepAliveDuringTransfer but i seems not useful
There is a way to increase the time in which FTP waits for a command?
Or it could be another problem in my code?
Thanks
Alberto

by (450 points)

1 Answer

0 votes

Ftp.ReceiveTimeout and Ftp.SendTimeout are set to 20 seconds by default. You may modify them:

client.ReceiveTimeout = TimeSpan.FromMinutes(1);

If 'No data received' error happens during large file transfers, it might indicate that control connection is closed due to inactivity.

Setting keep alive can be useful to prevent routers from prematurely closing the control channel while a long data transfer is taking place.

You may use KeepAliveDuringTransfer(TimeSpan noopInterval) method,
before starting the transfer, to send NOOP commands on the control channel at specified intervals:

client.KeepAliveDuringTransfer(TimeSpan.FromMinutes(1));

Please note that some FTP servers don't support receiving NOOP commands during file transfers.

It's been observed that these servers will act strangely: not reply to the command, or only send the reply after the file transfer has completed. This will cause the component to throw a timeout exception since it's expecting a reply within the timeout period.

You can also try KeepAliveTcp(TimeSpan keepAliveTime, TimeSpan keepAliveInterval) for example:

client.KeepAliveTcp(
    TimeSpan.FromMinutes(10), 
    TimeSpan.FromSeconds(1));

It causes the control socket to use TCP KeepAlive.

First parameter specifies the time after first KeepAlive is send.
Second parameter specifies the interval for subsequent KeepAlives.
Default TCP protocol values are 2 hours and 1 second.

You should also examine the logs:
https://www.limilabs.com/blog/logging-in-ftp-dll

by (276k points)
...