1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Uploading a file with SFTP from an EPICS driver |
From: | Freddie Akeroyd - UKRI STFC via Tech-talk <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Thu, 14 Nov 2019 15:58:12 +0000 |
Hi Mark, If you did need a libcurl library for windows there is one that uses the EPICS build system at
https://github.com/ISISComputingGroup/EPICS-curl by default it will expect the OpenSSL built from
https://github.com/ISISComputingGroup/EPICS-OpenSSL but can probably use one downloaded from elsewhere too Regards, Freddie From: Tech-talk <[email protected]>
On Behalf Of Mark Rivers via Tech-talk Folks, I am working on the driver for the Newport XPS motor controllers. These controllers can execute Position-Velocity-Time (PVT) trajectory scans which are complex multi-axis coordinated motion along a user-defined path
in 8-space. The trajectory is defined in a text file, which the EPICS driver creates and then uploads to the controller. The older XPS-C8 and XPS-Q8 controllers support FTP for the upload. I have a small C implementation of FTP which the driver uses. This
C code is standalone, it only needs to call the standard socket functions. The new XPS-D8 controller does not support FTP, it only supports SFTP/SCP. I need a solution to be able to do SFTP transfers from within my C++ EPICS driver. I want the solution to work on both Linux and Windows, and
ideally on vxWorks as well. I have tried 3 solutions, and measured the time that each solution required to upload a 5KB file. The results surprised me, and I am curious if anyone can explain them. The code for the 3 solutions is in the attached xpsSFTPUpload.cpp and the test program is testSFTPUpload.cpp. Solution 1. Use libssh2. This is selected if CONFIG_SITE defines HAVE_LIBSSH2=YES. Execution time = 326 ms Solution 2. Use libcurl with the curl_easy API. This is selected if CONFIG_SITE defines HAVE_LIBCURL=YES. Execution time = 323 ms Solution 3. Run the “curl” program with the C system() call. The driver builds the text of the curl command and runs it with the system() call. This is selected if CONFIG_SITE does not define HAVE_LIBSSH2=YES or HAVE_LIBCURL=YES. Execution time (Linux) = 126 ms Execution time (Windows) = 270 ms So on Linux running the “curl” command via a call to system() is actually almost 3 times faster than calling either of the libraries directly. This surprises me. Note that I actually prefer to use Solution 3 because it is easy to implement on Windows. There are several sites that provide downloads of a pre-built “curl” executable. However, I have not been able to find any site
that provides the libssh2 or libcurl libraries in a form that can be called from Visual Studio. They are built with mingw and give errors when I try to link with Visual Studio. Note that because of the performance measurements above I am not motivated to
pursue the library solution either, since it seems to be significantly slower. Ideally I would like this driver to work on vxWorks as well, but I don’t see any solution for doing sftp from within a C program on vxWorks? Thanks, Mark |