Questions about settings

Sep 20, 2011 at 12:02 AM

Hi

I have a few questions.

1. What is the default timeout set for a ftp connect? What is the default write/read/delete timeout?

2. I know my ftp sites that I am using seems to lose connection when you try to upload too much(like when I upload my web site(maybe like 20+ mb)  to my hosting site it firefox fireftp will reconnect several times). What happens if this occurs while using this library?

3. Is it possible to see how much space is left to make sure there is enough room to upload?

 

Coordinator
Sep 20, 2011 at 12:42 AM
Edited Sep 20, 2011 at 2:15 AM

1a) Timeouts: I'm not aware of a way to set the timeout, instead you have to perform an asynchronous connect. The latest revision includes 2 new methods: BeginConnect() and EndConnect(). They are still very much brand new and have barely been tested. I would wait until I get this feature further developed and tested, but the idea would be:

 

IAsyncResult res = cl.BeginConnect();

// wait 5 seconds...
res.AsyncWaitHandle.WaitOne(5000);

if (!cl.Connected) {
   cl.Disconnect();
   // error out....
}

 

1b) Read and write timeouts are controlled through the WriteTimeout and ReadTimeout properties from FtpControlConnection/FtpClient. AFAIK, there is no way to set a delete timeout. If you know something I don't feel free to point me in the right direction.

2) When executing a command on the server, the socket is automatically polled after a short period of inactivity. It's not polled on every command because of the performance hit, so what happens is a series of commands are executed and an internal time stamp is updated after every command. After X amount of seconds since the last command the socket is polled. If the poll fails the socket is automatically recycled and a new connection is established. You shouldn't have to worry about this, it should behave similar to what you described for firefox.

3) No, I don't believe so. I'm not aware of any specifications or extensions to the protocol that include a way to retrieve information about how much space is being used on the remote file system. Again, if you know something I don't feel free to point me in the right direction. One extremely inefficient way to "guess" would be to traverse the directory trees and tally up the file sizes. See the FtpDirectory class if you really want to do this.

 

When I get some extra time I'm going to work on the async connections more which should address your concerns about the connection timeouts.

Sep 21, 2011 at 12:20 AM
jptrosclair wrote:

1a) Timeouts: I'm not aware of a way to set the timeout, instead you have to perform an asynchronous connect. The latest revision includes 2 new methods: BeginConnect() and EndConnect(). They are still very much brand new and have barely been tested. I would wait until I get this feature further developed and tested, but the idea would be:

 

IAsyncResult res = cl.BeginConnect();

// wait 5 seconds...
res.AsyncWaitHandle.WaitOne(5000);

if (!cl.Connected) {
   cl.Disconnect();
   // error out....
}

 

1b) Read and write timeouts are controlled through the WriteTimeout and ReadTimeout properties from FtpControlConnection/FtpClient. AFAIK, there is no way to set a delete timeout. If you know something I don't feel free to point me in the right direction.

2) When executing a command on the server, the socket is automatically polled after a short period of inactivity. It's not polled on every command because of the performance hit, so what happens is a series of commands are executed and an internal time stamp is updated after every command. After X amount of seconds since the last command the socket is polled. If the poll fails the socket is automatically recycled and a new connection is established. You shouldn't have to worry about this, it should behave similar to what you described for firefox.

3) No, I don't believe so. I'm not aware of any specifications or extensions to the protocol that include a way to retrieve information about how much space is being used on the remote file system. Again, if you know something I don't feel free to point me in the right direction. One extremely inefficient way to "guess" would be to traverse the directory trees and tally up the file sizes. See the FtpDirectory class if you really want to do this.

 

When I get some extra time I'm going to work on the async connections more which should address your concerns about the connection timeouts.

Naw I don't have any info on any of this stuff. I have no clue about ftp and was just asking general questions of what I think I might need (of course what I might need may not exist)