Cannot connect to server - WeOnlyDo Discussion board

Cannot connect to server (wodSFTP / wodSFTP.NET / wodSFTPdll)

by freedom39, Wednesday, March 18, 2015, 22:00 (977 days ago)

Hi, I'm trying to connect to one of our sftp servers using the wodsftp component version 3.6.0.137 in Delphi XE2. I can connect to the server just fine using filezilla but for some reason I can't connect using wodsftp. I am not receiving any error messages from the server. When I connect, the status says 'Connecting to server', followed immediately by 'Disconnected from server'. changing the username and password seem to have no effect on this. The onConnect event is never fired as well. Thank you for your help.

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 06:43 (976 days ago) @ freedom39

Hi.

Can you paste the code you're using? This sounds to me like you didn't set Blocking = True so component immediately dies, but I cannot be certain without seeing the code where you initialize wodSFTP and where you connect.

Thanks!
Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:11 (976 days ago) @ Jasmine

wodSFTP1.Hostname := '*****';
wodSFTP1.Port := 22;
wodSFTP1.Login := '************';
wodSFTP1.Password := '***********';
wodSFTP1.Blocking := true;
try
wodSFTP1.Connect;
except
on E : Exception do
begin
Memo2.Lines.Add(TimeToStr(Time)+'>>'+E.Message);
end;
end;


If I disable blocking, the output is :
8:10:21 AM>>Connecting to server
8:10:21 AM>>Disconnected from server

If I enable it, it is :
8:10:21 AM>>Connecting to server
8:10:21 AM>>Disconnected from server
8:10:21 AM>>Unrecognized Error

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 14:13 (976 days ago) @ freedom39

Hi.

Can you tell me error number you're getting? Not just 'unrecognized', but exact error number.

Your code looks ok to me, so I don't see why this such a basic thing doesn't work.

Where is wodSFTP declared? Can you show me full code, where it's declared? I see you also use events, which I don't see here.

Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:20 (976 days ago) @ Jasmine

if I add the line
Memo2.Lines.Add(TimeToStr(Time)+'>>'+wodsftp1.ErrorText[wodsftp1.LastError]+' '+inttostr(wodsftp1.LastError));

I get this :
8:17:41 AM>>Connecting to server
8:17:41 AM>>Disconnected from server
8:17:41 AM>>Unrecognized Error
8:17:41 AM>>Unrecognized Error. -1


the events I am using is :

procedure TForm1.wodSFTP1StateChange(ASender: TObject; OldState: TOleEnum);
begin
Memo2.Lines.Add(TimeToStr(Time)+'>>'+wodsftp1.StateText[wodsftp1.State]);
end;

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 14:20 (976 days ago) @ freedom39

Did you declare wodSFTP globally or locally?

Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:23 (976 days ago) @ Jasmine

Globally. I added the component in the design view.

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 14:24 (976 days ago) @ freedom39

Can you try to connect to some other server, such as 'linux.weonlydo.com'? Use any username/password, I'm hoping you will get 'password invalid' error instead of -1

-1 basically means: all was ok, and connection was dropped for unknown reason.

Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:26 (976 days ago) @ Jasmine

Yea, I'm using wodsftp to connect to two other servers and it works just fine.

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 14:27 (976 days ago) @ freedom39

Ok, then it's something about this server.

Do you know what kind of software it's running? Are you able to enable debugging mode on that server?

Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:30 (976 days ago) @ Jasmine

Unfortunately, It is not our server so I don't have access to debugging it. I still find it strange that I am able to connect to it just fine using filezilla but not using wodsftp.

Cannot connect to server

by Jasmine, Thursday, March 19, 2015, 14:33 (976 days ago) @ freedom39

Hi.

Not every server is ideal - all of them have some quirks. It's possible Filezilla has some workaround for which wodSFTP doesn't have.

Also, you're using version 3.6.0 from 2011. Can you request update and try it out with the latest? Perhaps server didn't accept any crypto algorithm so just dropped the connection?

Jasmine.

Cannot connect to server

by freedom39, Thursday, March 19, 2015, 14:41 (976 days ago) @ Jasmine

I tried using every single encryption available with no luck. I will update it and see if that is the problem. Thank you