Bug 1294 - Active FTP request fails with System.IO.IOExeption (Not connected)
Summary: Active FTP request fails with System.IO.IOExeption (Not connected)
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Gonzalo Paniagua Javier
URL:
Depends on:
Blocks:
 
Reported: 2011-10-06 03:33 UTC by Andre Raabe
Modified: 2012-01-10 16:36 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample showing the exception when using active ftp connection (1.49 KB, text/plain)
2011-10-06 03:33 UTC, Andre Raabe
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andre Raabe 2011-10-06 03:33:13 UTC
Created attachment 618 [details]
Sample showing the exception when using active ftp connection

Overview:

Steps to Reproduce: 

Try to use the attached sample. You have to replace IP-Server, Username and Password and provide a simple file for transfer (in my case test.csv)

Actual Results:

Unhandled Exception: System.IO.IOException: Not connected
  at System.Net.Sockets.NetworkStream..ctor (System.Net.Sockets.Socket socket, FileAccess access, Boolean owns_socket) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.NetworkStream..ctor (System.Net.Sockets.Socket socket, Boolean owns_socket) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Net.Sockets.NetworkStream:.ctor (System.Net.Sockets.Socket,bool)
  at System.Net.FtpWebRequest.OpenDataConnection () [0x00000] in <filename unknown>:0
  at System.Net.FtpWebRequest.DownloadData () [0x00000] in <filename unknown>:0
  at System.Net.FtpWebRequest.ProcessMethod () [0x00000] in <filename unknown>:0
  at System.Net.FtpWebRequest.ProcessRequest () [0x00000] in <filename unknown>:0

The ftp server logfile logs:

FTP response: Client "<IP-Adress>", "230 Login successful."
FTP command: Client "<IP-Adress>", "OPTS utf8 on"
FTP response: Client "<IP-Adress>", "200 Always in UTF8 mode."
FTP command: Client "<IP-Adress>", "PWD"
FTP response: Client "<IP-Adress>", "257 "/""
FTP command: Client "<IP-Adress>", "CWD /"
FTP response: Client "<IP-Adress>", "250 Directory successfully changed."
FTP command: Client "<IP-Adress>", "TYPE I"
FTP response: Client "<IP-Adress>", "200 Switching to Binary mode."
FTP command: Client "<IP-Adress>", "PORT XX,XX,XX,XX,239,83"
FTP response: Client "<IP-Adress>", "200 PORT command successful. Consider using PASV."
FTP command: Client "<IP-Adress>", "RETR test.csv"
FTP response: Client "<IP-Adress>", "150 Opening BINARY mode data connection for test.csv (8 bytes)."
OK DOWNLOAD: Client "<IP-Adress>", "/test.csv", 8 bytes, 4.62Kbyte/sec
FTP response: Client "<IP-Adress>", "226 Transfer complete."


Expected Results:

The file can be successfully downloaded / transfered.

Build Date & Platform: 

Mono JIT compiler version 2.6.7 (Debian 2.6.7-5ubuntu3) (x86)
Mono JIT compiler version 2.8.2 (tarball Wed Feb 23 09:31:21 UTC 2011) (amd64)

Additional Builds and Platforms:

Works ok on Microsoft Windows (XP SP3, Windows 7 SP1).

Additional Information:

FTP Server used vsftpd 2.3.2 with pasv_enable=NO.
Comment 1 Gonzalo Paniagua Javier 2012-01-10 16:36:04 UTC
Fixed in master/cf20cad and mono-2-10/81061e6.
Note that response.ContentLength is -1, so yo need to change the test to actually write the file.