sharp-ftp-server icon indicating copy to clipboard operation
sharp-ftp-server copied to clipboard

Cannot get anything after LIST command in FTP client.

Open HerbZhu opened this issue 12 years ago • 0 comments

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.

HerbZhu avatar Feb 11 '14 23:02 HerbZhu