views:

236

answers:

2

I tried posting on their boards (authors of this library), however it literally takes months for them to reply when it comes to the free software (can't blame them).

But anyways I have found that this library is behaving weirdly - for instance, a major problem with my application is when someone is trying to sign in (through FTP), they provide a correct login and mistype the password, no reply is received from FTP server.

I tried doing the same from command window just to verify that it's not the FTP server's fault; and FTP commands were received instantaneously.

It almost looks as though this library eats the commands. The same actions often times will yield different results.

Can anyone recommend a stable, reliable library to use with Compact framework? Or shed some light on this issue...?

A: 

Which FTP set are you using, the stream-based classes in the SDF, or the separate one in the Forums? If you're using the one from the forums (which is the one I actually recommend), then you've got the source. I wrote that one from the ground up by looking at nothing by the RFC. It's really, really simple and if it's "eating" responses, it's likely a timeout issue, though it should be easy to put in a break point and see where it's coming apart.

ctacke
Hi Chris, yes I am using the one in the forums (so I can look in the source code). I actually put a debug output statement inside ReadResponse() function and surely enough, when a user types in their account number and wrong password, all I get from the FTP server is 220 and then 331 codes. Afterwords, it just stalls. However, it doesn't always happen, but it happens often enough for the users to complain. I would rather not modify the source code at all as it will require for me to go through it and understand it and I don't have time allocated for this.
gnomixa
which time-out are you talking about? the server time out or the connection time out? I am assuming it's the connection time out.
gnomixa
So, here is where it eats the response(inside ConnectThread) if( response.ID == 331 ) { MessageBox.Show("sending p/w"); response = SendCommand("PASS " + m_pwd, false); MessageBox.Show("end: response id: " + response.ID.ToString()); if( !((response.ID == 202) || (response.ID == 230)) ) { m_cmdsocket.Close(); m_cmdsocket=null; Disconnect(); m_connected = false; return; } }after p/w is sent, I get 0 as response.
gnomixa
ok, this is officially driving me INSANE. (sorry for caps).now it's working all of a sudden. What the?also, I have a question for you: how come CommandSent is never raised even though the login is successful (in the case where login and password are correct)CommandSent != null is ALWAYS false. Is that normal???
gnomixa
+1  A: 

I modified the source code inside ConnectThread() as follows:

// if a PWD is required, send it
      if( response.ID == 331 )
      {

                response = SendCommand("PASS " + m_pwd, false);

                //ADDED THIS - try again.
                if (response.ID == 0)
                {
                    response = SendCommand("PASS " + m_pwd, false);
                }
                //end of my addition

                if( !((response.ID == 202) || (response.ID == 230)) )
                {
                    m_cmdsocket.Close();
        m_cmdsocket=null;
                    Disconnect();
        m_connected = false;
        return;
                    }
}

This solved the issue for awhile, until now it started doing it again, the culprit seems to be when 0 is coming back as a response from FTP server, the connection just stalls. I am not sure whether it is a socket issue or some other obscure problem, but I think I am going to give up at this point.

gnomixa
I'm going to move that library over to Codeplex so it will be easier to maintain and accept patches.
ctacke
Actually, it still doesn't work, it just did it again. so I spoke too soon. Do you have any idea on why 0 is received as a response from the FTP server?
gnomixa