i need your support to integrate wwsftp class in our application. the following prgs and dlls are set in my project.
- wwsftp.prg
- wwftp.prg
- wwdotnetbridge.prg
- wwapi.prg
- wwutils.prg
- wconnect.h
- wwipstuff.dll
- wwdotnetbridge.dll
this is my example code, with FileZilla is the connect successfull.
*###############################
oFTP = CREATEOBJECT("wwSFTP")
! oFtp.cFtpServer = 'xxxxxxxx.de'
! oFtp.cUsername = 'blubb'
! oFtp.cPassword = "blubbpassword"
oFtp.nFtpPort = 21
oFtp.cPrivateKeyFile = "c:\vfp9\alva\sftp\alva.ppk"
oFtp.cPrivateKeyFilePassword = "xxxxxxxx"
lcServer = 'xxxxxxxxx.de'
lcNutzer = 'xxxxxx'
lcPasswort = 'xxxxxx'
lResult = oFTP.FTPConnect(lcServer,lcNutzer,lcPasswort)
IF lResult#0
oFTP.FTPClose()
=MESSAGEBOX("Die xml-Dateien konnten nicht vom FTP-Server abgeholt werden."+CHR(13)+CHR(10);
+"(FTP-Zugang fehlerhaft - ErrorCode "+ALLTRIM(STR(lResult))+")"+CHR(13)+CHR(10)+CHR(13)+CHR(10);
+"Bitte prüfen Sie die Programmeinstellungen.",16)
)
RETURN .F.
ENDIF
*########################################
the code crashes in the class at the method connect, which you can see in the screenshot
The code you're showing in the screen shot is different than the code you're posting.
The screen shot is using .Connect()
which is not valid - you need to use .FtpConnect()
.
Also make sure that server you're accessing is SFTP
and not FTPS
which are not the same thing. FTPS is not supported by this class.
+++ Rick ---
Hi Rick,
The code in the screenshot is your code from the wwsftp.prg that I added to my project.
My example code works with the FtpConnect().
Thank you for your help. Jens
Hi Rick,
I probably expressed myself wrong! The sample code works, but the problem persists and the code crashes in your wwsftp.prg, you can see that in the screenshot. You know what it is?
Thank you for your help. Jens
Yeah i don't know what you're asking or even what you're referencing. The code in the debugger is just plain wrong as it uses .Connect()
and so yes that should be failing.
Then you reply and say that it works with .FtpConnect()
and now you're back saying something else again?
Maybe regroup and state your question from scratch...
+++ Rick ---
My sample code creates an instance from your sftp class, and then I use the ftpconnect () method.
However, the ftpconnect () method calls the connect method, which then crashes in the debugger with an error message, which you can see in the screenshot.
If you say the Connect method will fail, why is it used in your method?
Jens
Ok got it.
Unfortunately not sure given the limited info available.
Does it fail right away or does it seem like it's trying to connect then fail?
If it fails immediately the most likely problem is related to the DLL dependencies. Make sure that the renci.sshnet.dll
is available in your path. Also check and make sure the DLL is unblocked if it exists.
Just double checked here - with the DLL missing you do get that exact error.
I've updated wwDotnetBridge.dll
to trigger a more descriptive error when you first load the wwSftp
class which is definitely more useful. You can grab the updated DLL from here:
+++ Rick ---