Using SFTP to copy local files to a distant server

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

Using SFTP to copy local files to a distant server

Post by Phil-ok » Sun Sep 04, 2016 7:40 am

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

User avatar
doublemax
Moderator
Moderator
Posts: 14319
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax » Sun Sep 04, 2016 8:02 am

No.

I would recommend libcurl to do that.
Use the source, Luke!

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Sun Sep 04, 2016 8:34 am

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

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Sun Sep 04, 2016 8:51 am

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

Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

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

Post by Nunki » Sun Sep 04, 2016 3:41 pm

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...

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Sun Sep 04, 2016 3:55 pm

Thank you,
But it seems that this lib is not opensource. Is it ?
Regards

User avatar
doublemax
Moderator
Moderator
Posts: 14319
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax » Sun Sep 04, 2016 4:15 pm

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 :)
Use the source, Luke!

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Sun Sep 04, 2016 4:53 pm

Thanks

User avatar
doublemax
Moderator
Moderator
Posts: 14319
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax » Sun Sep 04, 2016 5:06 pm

BTW: For SFTP you need a package that has SSL and SSH included.
Use the source, Luke!

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Sun Sep 04, 2016 5:17 pm

May be this one : Win32 7zip 7.50.1 binary SSL SSH Viktor Szakáts 1.56 MB
Thanks

eranif
Moderator
Moderator
Posts: 606
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

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

Post by eranif » Sun Sep 25, 2016 4:59 pm

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
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

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

Post by Phil-ok » Tue Sep 27, 2016 5:03 am

Thank you.
Can you bring an example of a short code that would open a connection and upload a file to the distant server ?

Post Reply