Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
DownloadDataType Binary value ignored on ASCII-configured FTP servers #318
FTP OS: Unknown
FTP Server: Unknown
Computer OS: Windows 10
When working with an FTP server that is configured in ASCII mode by default, the default DownloadDataType value of Binary is not respected. I attached two log files. Both show the trace of a DownloadFile call followed by a GetFileSize call, where DownloadDataType is set to Binary.
BINARY_Log.txt - Run against a server configured as binary. Everything works fine.
This seems to be a result of the fact that the FtpClient_LowLevel.SetDataType() method checks to see if the supplied data type has changed from its previous value. Since the default is Binary, it hasn't, so the "Type I" command is never sent to the server. Currently I'm getting around this by executing that command manually before calling DownloadFile.
Foustain - great question - I think have the same problem accept the other way around. I am connecting to a Binary FTP server - and no matter what I do I can't get the software to issue a TYPE A command. I am sort of a newbie to this stuff - how did you manually send the Type 1 command before the downloadfile - can you post a snippet. Thanks in advance
@Foustian that was an optimization that apparently went wrong. What should happen here, TYPE should be sent before every transfer? Can you elaborate because this is a high priority issue.
Also, when you say server was configured for ASCII what do you mean? Thanks for the detailed description and logs.
referenced this issue
Aug 24, 2018
I don't really know the technical details of the servers I was testing with. I just know that one ran commands as ASCII and the other ran them as binary by default. I figured there had to be some difference in their configuration that caused that.
As for what should happen, it seems like TYPE should be sent at the start of every connection at least. Unless there's some way to determine if the server has already been set to whatever mode the user has specified. Otherwise if the server runs as ASCII, any call of GetFileSize is going to fail and DownloadFile is going to return corrupted data. Those are the only methods I use, so I'm not sure what else might be affected.
I hope that's helpful. I'm not very familiar with FTP.