Query on FTP commands - WeOnlyDo Discussion board

Query on FTP commands (General questions)

by 2BS, Tuesday, August 31, 2004, 15:28 (7190 days ago)

I'm interested in using your FTP component, especially because of the SSL support. I've had a look through the online help file, but I can't find details on the following:

- Is there a read-timeout value? So if blocking is used, will it eventually return if the FTP server hangs?

- How do you change directory and get the current directory?

- Can you use SITE commands, e.g. CHMOD

- If the modification date & time for a file is changed, and the server supports MDTM set, will the date & time be set?

Thanks

Re: Query on FTP commands

by wodSupport, Tuesday, August 31, 2004, 15:33 (7190 days ago) @ 2BS

2BS, let me try to answer your questions:

- Is there a read-timeout value? So if blocking is used, will it eventually return if the FTP server hangs?

Yes, there is a Timeout property you can set. If nothing happens for specified number of seconds, timeout expires and error is returned.

- How do you change directory and get the current directory?

You don't! You always use full paths to access the server. So, instead of doing this:
CD /temp
RETR filename

you would use this:
Ftp.GetFile /temp/filename

and wodFtpDLX will internally do all neccessary operations. SFTP protocol doesn't even support changing directory - so we decided to use same approach with other protocols too (so that component is fully transparent in usage for all supported protocols).

- Can you use SITE commands, e.g. CHMOD

Yes, indirectly. You should use RawSend method, and then catch response with FTPReply event.

- If the modification date & time for a file is changed, and the server supports MDTM set, will the date & time be set?
No, it will not. But we're open to suggestions on adding new features. So, if you need this - we can add it (free of charge).

Regards,
Kreso

Re: Query on FTP commands

by 2BS, Wednesday, September 01, 2004, 03:35 (7189 days ago) @ wodSupport

> - How do you change directory and get the current directory?

You don't!

But how do I check if a directory exists? At present I just go to that directory, and if it fails, then it doesn't exist. Not airtight I know (because it may be security reasons, and not that it doesn't exist).

- If the modification date & time for a file is changed, and the server supports MDTM set, will the date & time be set?
No, it will not. But we're open to suggestions on adding new features. So, if you need this - we can add it (free of charge).

I would certainly need this. This is for a file synchronization/backup program, so it's critical that the modification date & time of files are changed correctly.

Thanks for answering, but I've got a couple more questions:

- Is it thread safe? i.e. can I have multiple threads each with their own instance of the FTP component?

- If the connection is dropped, and I reconnect, is the DirList property cleared? It's important to me that it isn't - strange request I know, but it'd take a long time to explain why [:wink:]

Thanks

Re: Query on FTP commands

by wodSupport, Wednesday, September 01, 2004, 11:52 (7189 days ago) @ 2BS

2BS

But how do I check if a directory exists? At present I just go to >that directory, and if it fails, then it doesn't exist. Not >airtight I know (because it may be security reasons, and not that >it doesn't exist).

You cannot do it. Try to get ListDir from it. If it doesn't exist, you will get an error.

Is it thread safe? i.e. can I have multiple threads each with their own instance of the FTP component?

Yes it is, but it is very important that you use one instance from (and only from!) the same thread where you initialized it. It is apartment-threaded. You can have any number of threads, each of them having one instance of wodFtpDLX. That will work.

If the connection is dropped, and I reconnect, is the DirList property cleared? It's important to me that it isn't - strange request I know, but it'd take a long time to explain why

Yes it is. Each time ListDir is requested, DirItems property is cleared so it can accept new results. Why do you ask, did you notice different behavior?

Regards,
Kreso