Howto implement SFTP with Qt/QNetworkAccessManager (C++)

前端 未结 4 1530
南方客
南方客 2021-02-05 22:43

I\'m new to Qt and I would like to implement FTP and SFTP support for my software. As I googled I discovered that there doesn\'t exist a sftp library for Qt but it should be pos

4条回答
  •  既然无缘
    2021-02-05 23:38

    There's no current SSH wrapper implementation in the Qt SDK. You have 3 choices here:

    1. Roll your own custom SSH/SFTP client implementation using the IETF RFC and standard drafts like RFC4253. This might not be what you're looking for.
    2. Use any of the ssh implementation libraries like openssh/libssh directly or writing your own Qt/C++ wrapper for future-reuse. Any reasonably decent project with ssh needs usually links to a an already established ssh library and uses it programatically. Like Qt Creator does, if you dig inside it long enough you'll find what user Paglian mentioned earlier. Relying on a library is less risky and more future-proof then rolling your own.
    3. Use openssh tooling at the command line interface directly, using QProcess just like you'd use it at the shell. This is is the fastest method if you're working on a proof-of-concept project and don't need any complex ftp operations, as it might get a bit difficult to devise a robust wrapper around the CLI tooling.

提交回复
热议问题