Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.5k views
in .NET FTP by (160 points)
Hi,

I need to execute LIST command 'cause my FTP server gives out, through LIST executed on FTP clients, the following lines:

[R] 125 Data connection already open; Transfer starting.
[R] 226-Directory has 10,387,456 bytes of disk space available.
[R] 226 Transfer complete.
[R] List Complete: 143 bytes in 0.27 seconds (0.5 KB/s)

So I can use LIST to get free space on remote disk.

But trying to execute

Dim lstcmd As FTPReply = ExFTPConnection1.InvokeFTPCommand("LIST", codestr)

where codestr is a string array containing all codes betwen 0 an 999, I just get this reply, often through an exception:

lstcmd.ReplyCode -> "150"
lstcmd.ReplyData -> Nothing
lstcmd.ReplyText -> "Opening BINARY mode data connection."

I tryed to switch Trasfer mode in ASCII but anything is changed.

It's a must to execute LIST command through InvokeFTPCommand to get free space.

Can someone help me?

Thanks

2 Answers

0 votes
by (51.6k points)
The LIST command, like RETR (download) and STOR (upload), opens up a data-channel and transfers the listing on that channel. InvokeFTPCommand does not support handling of data-channels; it simply writes the command you designate to the control-channel and reads the reply on the control channel. You therefore cannot use InvokeFTPCommand for this purpose.

Have you looked at FTPConnection.LastValidReply after calling FTPConnection.GetFileInfos()? That may hold the information you're after. Failing that, try handling the ReplyReceived event, which gets triggered for every reply that's read from the control-channel.

- Hans (EnterpriseDT)
0 votes
by (160 points)
It works fine!!

Thanks a lot.

Sometimes we don't mind simplest way to solve simple problems.

May I turn around my brain through a week?? May be...

Thanks once again...

Categories

...