Cannot get anything after LIST command in FTP client.
Just write an FTP Client with FtpWebRequest, but can not read anything after using the command WebRequestMethods.Ftp.ListDirectoryDetails.
//////////////////////////////////////////////////////////////////////////////////////// // Code in the FTP client List<FileInformation> List(string uri) { FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(uri); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; FtpWebResponse response = request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader streamReader = new StreamReader(responseStream); string strList = streamReader.ReadToEnd(); // here, strList always is empty, i.e., "". .... } ////////////////////////////////////////////////////////////////////////////////////////
I have reset the user.xml to a valid folder with some files. In debug mode, I saw FtpClientConnection.ListOperation was executed "correctly" (I mean I saw dataWriter.Write() was called with correct number of times matching with the number of files in homeDir).
Any clue? Thanks!
I am with VisualStudio 2010.