in Compact Framework, the Ftp Protocol is not implemented so I developed it myself.
I've a question about the passive mode and commands that need to have a data channel to read the response.
In my case, I'm trying to retrieve (RETR) a file on my FTP Server, So I do :
Part that works well :
- OpenControlChannel
- ReadControl (Banner Message)
- SendUser
- ReadControl (Awaiting pass?)
- SendPass
- ReadControl (Welcome Message)
- SendPassive
- ReadControl (Extract IP for the DataChannel)
Parts that doesn't work very well (but work too, see explanation below)
- RETR myFile
- OpenDataChannel
- ReadControl (Here I become the message "Begin Transfert" AND "Transfert complete", before reading any data !)
- ReadData
- CloseDataChannel
- CloseControlChannel
Problem is, I need just to open data channel to have the message "Transfert complete" even if I haven't read any data on the stream, is this behavior normal?
For me, when I open the data channel I should just receive
"150 Opening ASCII mode data connection for a.she (0 bytes).\r\n"
Then once the read operation done :
"226 Transfer complete.\r\n"
When I look to the classic Ftp protocol used in the .NET Framework, it is the case :
FtpWebResponse ftpres = (FtpWebResponse)ftp.GetResponse();
// ftpres.StatusDescription = "150 Opening ASCII mode data connection for a.she (0 bytes).\r\n"
string res = new StreamReader(ftpres.GetResponseStream()).ReadToEnd();
// ftpres.StatusDescription = "226 Transfer complete.\r\n"
Hope I'm clear enough... Thanks !