curl-library
RE: Does libcurl support signal-sent event (SSE)?
Date: Tue, 26 Aug 2014 13:07:49 +0200 (CEST)
On Mon, 25 Aug 2014, Bruno BARRUCAND wrote:
> I want server to send data sometimes but without being locked.
libcurl provides two ways to use it. The easy interface which is synchronous
and blocking, and the multi interface which is non-blocking. You decide which
one you want.
> I can read data sent by SSE server if I set a breakpoint in function
> write_data. write_data is a function defined as curl_easy_setopt(curl_,
> CURLOPT_WRITEFUNCTION, write_data). curl_easy_perform returns always on
> timeout (set to 60s).
You're doing a HTTP request that basically never ends, so yes if you set a
timeout it will trigger.
> It is as curl_easy_perform is waiting for end of message and doesn't
> understand it is SSE messages.
"SSE" is not special for libcurl, you're talking plain HTTP and libcurl knows
HTTP.
> It is why I am wondering if libcurl supports Signal-Sent Event and how to
> use it.
You basically have two option as I see it:
1 - fire up a separate thread and use the curl_easy_perform there and allow it
to block
2 - use curl_multi_perform or curl_multi_socket_action and don't do it in a
blocking manner
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2014-08-26