开发者

Using libcurl with libevent

开发者 https://www.devze.com 2023-03-25 10:18 出处:网络
Can anyone show (through code) or explain to me how I might use libevent and curl together in a c program? I\'m trying to write a high-performance no开发者_如何学运维n-blocking data monitor which need

Can anyone show (through code) or explain to me how I might use libevent and curl together in a c program? I'm trying to write a high-performance no开发者_如何学运维n-blocking data monitor which needs to upload data to a CouchDB instance. I'm familiar with both libevent and curl, but merging curl_multi with libevent has me stumped for some reason. I do not understand the program flow of the offical libcurl example - can anyone point me to, or supply, a simpler example?


The key is really the curl_multi_socket_action() function that should be used as soon as your event library says there's something on a socket to deal with. Event-based libcurl is more complex than "plain" libcurl so doing a very easy example is not that straight forward.


One exotic way to use curl with libevent is in a coroutine.

0

精彩评论

暂无评论...
验证码 换一张
取 消