Page 1 of 1

Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 7:40 am
by Phil-ok
Hello,
Is it possible, directly with wxWidgets, to make a sftp connection in order to copy files from local to a distant server ?
Regards
Philippe

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 8:02 am
by doublemax
No.

I would recommend libcurl to do that.

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 8:34 am
by Phil-ok
Thank you !
Would you have a simple example of a SFTP copy action ?
There are examples on the libcurl site, but not so easy for a newbye.
Best regards
Philippe

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 8:51 am
by Phil-ok
I found those 2 examples
ftpupload.txt
sftpget.txt
Now I need to install the lib (I use codeblock to build windows programs with static lib).
You would be the best place to ask for help for this installation ?
Thanks again
Philippe

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 3:41 pm
by Nunki
I use the chilkat library for almost 3 years now and it has a lot of functionalities that nicely fill in the things that wxwidgets is missing. Not that wxwidgets needs to have these, for all, wxwidgets is all about the gui. Things like FTP/SFTP, IMAP, POP3, XML, Zip etc...

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 3:55 pm
by Phil-ok
Thank you,
But it seems that this lib is not opensource. Is it ?
Regards

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 4:15 pm
by doublemax
Now I need to install the lib (I use codeblock to build windows programs with static lib).
In general all you need to do is find a binary for your system ( https://curl.haxx.se/download.html ), unpack it, set the include and library paths and add the library itself. But as usual: As i don't use CB, i can't tell you exactly where and how :)

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 4:53 pm
by Phil-ok
Thanks

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 5:06 pm
by doublemax
BTW: For SFTP you need a package that has SSL and SSH included.

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 04, 2016 5:17 pm
by Phil-ok
May be this one : Win32 7zip 7.50.1 binary SSL SSH Viktor Szakáts 1.56 MB
Thanks

Re: Using SFTP to copy local files to a distant server

Posted: Sun Sep 25, 2016 4:59 pm
by eranif
Hi, a bit late, but better late than never...

I have already implemented this in CodeLite IDE - which is an open source GPLv2.
You can see the sources here:

clSFTP class:
https://github.com/eranif/codelite/blob ... /cl_sftp.h

clSFTP uses clSSH for the session:
https://github.com/eranif/codelite/blob ... e/cl_ssh.h

I have written this based on libssh (NOT libssh2) and it is working for couple of years now on Windows/Linux and OSX

Re: Using SFTP to copy local files to a distant server

Posted: Tue Sep 27, 2016 5:03 am
by Phil-ok
Thank you.
Can you bring an example of a short code that would open a connection and upload a file to the distant server ?