Home Forums .NET libraries Xceed SFTP/FTP for .NET FTP I/O error when trying to send file

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20838 |

    Hi there,

    I’m using the Xceed.ftp .Net component to send a file to a remote ftp server.
    This is an intranet applications, so the connection to the ftp server does not have to be secure.

    This is how my code looks like:

    ftp = new Xceed.Ftp.FtpClient();
    http://ftp.Connect(“server.ftp.com”, 21);
    http://ftp.Login(“username”, “password”);

    fs = new FileStream(“C:\local.zip”, FileMode.Open, FileAccess.Read, FileShare.Read);
    http://ftp.SendFile(fs, “Upload_33.zip”);

    I managed to logged in just fine and get connected to the ftp server, but every time it hit the point when it’s trying to send the file – it will paused and then throw this error:

    “An I/O error occurred while accepting the FTP server’s data connection.

    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Error executing task IOOC Export.FTP upload zip file.

    I checked the ftp server and there’s a file named “Upload_33.zip” with size = 0 bytes… I guess somehow this ftp connection is dropped ?
    can anybody help?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by henkya (had 19748 views)

    User (Old forums)
    Member
    Post count: 23064

    One extra note:
    If connect to the FTP server manually and upload a file manually – everything works solid

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by henkya (had 1319 views)

    User (Old forums)
    Member
    Post count: 23064

    With the other ftp client, do you also specify the port on which you connect?

    Can you set the TraceWriter property so we can get a log of the communication with the server?

    FtpClient.TraceWriter = new StreamWriter( @”D:\ftp.log”, true );

    The problem is that the Command channel is open fine, and the commands are sent correctly to the server, but the Data channel (on which the data of the file is sent) connection is not establish. It is hard to say at this point what is the source of the problem.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 432 views)

    User (Old forums)
    Member
    Post count: 23064

    I am receiving the same error. We are using an ssl/ftp connection with the authentication method set to Tls, and the port is set to 990.

    if I set the timeout to a long value, then after about 11 minutes I get the IO error. if I set it to more around 1 minute then I just get a timeout error.

    Here is the output from the log file. Any help would be appreciated.

    Connected to 66.181.11.90:990 on 4/30/2007 @ 1:07:18 PM
    < 220
    > USER aviacode
    < 331 Password required
    > PASS *****
    < 230-user logged in
    < Welcome to Imaging Service’s Transcription FTP Server
    < Please do not use this for anything other than what it was intended
    < 230 user logged in
    > TYPE I
    < 200 Type set to IMAGE.
    > PASV
    < 227 Entering Passive Mode (66,181,11,82,4,0).
    > STOR TestFile.zip
    Data connection established with 66.181.11.82:1024 on 4/30/2007 @ 1:07:20 PM
    < 150 Opening BINARY data connection for TestFile.zip

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by JoeEames (had 1135 views)

    User (Old forums)
    Member
    Post count: 23064

    Is there a firewall/proxy between your client and the server?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 792 views)

    User (Old forums)
    Member
    Post count: 23064

    yes, but ports 21, 990, and 1024 are all open. why does the data connection connect over a different port than 990?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by JoeEames (had 912 views)

    User (Old forums)
    Member
    Post count: 23064

    It is normal that the data channel be connected to a different port. Port 21 or 990 normally serve for the command channel connection. This is how is built the FTP protocol, there are two sockets that need to be open, one for the data channel and the other for the command channel, and they cannot be opened on the same port.

    In passive mode, as you are, it is the server that decides which port to use for the data channel. If your firewall does not allow connection on this port, then the connection will not work, of course. You can try to connect in non passive mode. This way, it is the client that will determine on which port to make the data channel connection, and you can open the corresponding port in the firewall. You can set the port through the LocalDataAddress property on FtpClient.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 645 views)

    User (Old forums)
    Member
    Post count: 23064

    this is getting kind of annoying. I can connect to the ftp server just fine using any client i care to try. Using FireFTP, with the settings on Passive Mode, Implicit SSL (instead of Auth TLS or Auth SSL) and set to port 990, it connects like a charm.

    but no matter what I try I can’t get xceed zip to connect to the ftp server and send up a file.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by JoeEames (had 807 views)

    User (Old forums)
    Member
    Post count: 23064

    Do you have the log of the communication with the server from one of the other client you are using, so we can compare what is different from our library? Do you connect implicitly with our library?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 677 views)

    User (Old forums)
    Member
    Post count: 23064

    Here is the log with FireFTP

    220
    PBSZ 0
    200 PBSZ=0
    USER aviacode
    331 Password required
    PASS (password not shown)
    230-user logged in
    Welcome to Imaging Service’s Transcription FTP Server
    Please do not use this for anything other than what it was intended
    230 user logged in
    FEAT
    211-Extensions supported
    SIZE
    XCRC
    XMD5
    XSHA1
    XSHA256
    XSHA512
    XSIGN
    MDTM
    MLST
    size*;type*;perm*;create*;modify*;
    LANG EN*;SP
    REST STREAM
    TVFS
    UTF8
    AUTH SSL;TLS-P;
    PBSZ
    PROT C;P;
    211 end
    PWD
    257 “/aviacode” is current directory
    TYPE A
    200 Type set to ASCII.
    PROT P
    200 PRIVATE data channel protection level set
    PASV
    227 Entering Passive Mode (66,181,11,82,4,0).
    LIST
    150 Opening ASCII data connection for directory listing

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by JoeEames (had 792 views)

    User (Old forums)
    Member
    Post count: 23064

    The log and code that you posted for our component is not using SSL/TLS, whereas you use it for FireFTP. Did you try a secure connection with our component? If so, can I see the code and the log when it fails?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 607 views)

    User (Old forums)
    Member
    Post count: 23064

    Here’s code I wrote that fails. I believe this is pretty much exactly like the sample in your docs. I am also using the same code to connect to a different client’s ftp server with no hickups. the client that is failing is using wsftp for their ftp server. I removed our license key & the ip address & username/pass. I’m working to get a test username/pass to give you.

    public void Send()
    {
    Licenser.LicenseKey = “”;
    AsyncFtpClient client = new AsyncFtpClient();
    client.Timeout = 20;
    client.PassiveTransfer = true;
    client.CertificateReceived += new CertificateReceivedEventHandler(client_CertificateReceived);
    using (client.TraceWriter = new StreamWriter(@”ftp.log”, true))
    {

    AuthenticationMethod authentication = AuthenticationMethod.Tls;
    client.Connect(“”, 990, authentication, VerificationFlags.None, null);
    Logger.LogDebug(“Connected to ” + “”);
    client.Login(“”, “”);
    Logger.LogDebug(“Logged in as ” + “aviacode”);
    client.SendFile(“sample.txt”);
    Logger.LogDebug(“File Sent – ” + “Sample.txt”);
    client.Disconnect();
    }
    client.CertificateReceived -= new CertificateReceivedEventHandler(client_CertificateReceived);
    }

    static void client_CertificateReceived(object sender, CertificateReceivedEventArgs e)
    {
    e.Action = VerificationAction.Accept;
    }

    here’s the log from a session using this code. the log terminates after the 150 command

    Connected to 66.181.11.82:990 on 5/8/2007 @ 2:22:51 PM
    < 220
    > USER aviacode
    < 331 Password required
    > PASS *****
    < 230-user logged in
    < Welcome to Imaging Service’s Transcription FTP Server
    < Please do not use this for anything other than what it was intended
    < 230 user logged in
    > TYPE I
    < 200 Type set to IMAGE.
    > PASV
    < 227 Entering Passive Mode (66,181,11,82,4,0).
    > STOR sample.txt
    < 150 Opening BINARY data connection for sample.txt

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by JoeEames (had 1163 views)

    User (Old forums)
    Member
    Post count: 23064

    Can you write to <a href=”mailto:support@xceedsoft.com”>support</a>, so we can connect to your server and try to identify the problem?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 8859 views)

    User (Old forums)
    Member
    Post count: 23064

    I have the same error message on one computer. Works fine on another machine. Get the message on SendFile. No errors in the CommandLogFilename.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Ted (had 1993 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    There is a lot of things that can happen that can make a FTP session fail. 

    We need more information.  If possible, an access to your FTP server so we can analyze the communication.  Send this information at support@xceed.com with a reference to the forum message id. 

    Regards

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Ghislain (had 2895 views)

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.