curl / Mailing Lists / curl-library / Single Mail

curl-library

asynchron events / the easy interface

From: Alexander Eisenhuth <ae_at_stacom-software.de>
Date: Thu, 12 Apr 2018 11:03:41 +0200

Hello Everybody,

I'm new to libcurl and I implemented a FTP client in C++ using the easy
interface under windows. My needed functionality (get, put, rm, ...) are
so far fine - thanks a lot to everybody for the code and doc. But I've
two requirements that I'm not sure I can implement with the easy
interface, that are:

1) Getting informed, when the FTP server closes the connection in a
async way (without a FTP request) - as it would do afetr a while when
sending no request
2) Using keep alive messages to prevent from disconnecting

1) Here I've no idea how to achive this with the easy interface as I
doesn't see a callback that I can register for that purpose. I tried a
bit with CURLOPT_CLOSESOCKETFUNCTION, but wasn't successful.
2) I'v implemented

     // enable TCP keep-alive for this transfer
     int sec = 60;
     curl_easy_setopt(mCurl, CURLOPT_TCP_KEEPALIVE, 1L);
     curl_easy_setopt(mCurl, CURLOPT_TCP_KEEPINTVL, static_cast<long
>(sec));
     // initial delay for first keep alive
     curl_easy_setopt(mCurl, CURLOPT_TCP_KEEPIDLE,1L);

, but as I understand libcurl with the easy interface has no own thread.
So I'm a bit confused how keepidle works.

Any help to support me to implement my two points is very welcome

Thanks a lot
Alex

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-04-12