On Fri, 27 Jan 2012, [email protected] wrote:

So my question.  Is there a simple way to split the sending of the HTTP requests and the processing of the responses on a per connection basis using libCurl?

I don't quite understand why you'd even want that? In HTTP you can very well start receiving data before you've completed sending your request, they're not easily separatable.

I've looked at the one multi-socket example that I found but it seems a bit more complex than what I was looking for, and it sounds like when the curl_multi_socket_action() function is called that it will process any connections that are pending in the multi handle, and we need to track each individual connection that is processed for context.

The multi-socket API is perfect if you want to use an event-based driven application. If you "just" want non-blocking selcet() style, I suggest you use curl_multi_perform() instead.

Is there another multi example available that would be closer to what we need to do?  I've done some searching with Google but haven't turned up very much yet.

This example: http://curl.haxx.se/libcurl/c/multi-app.html makes a simple multi interface application. All you need is to add CURLOPT_POSTFIELDS or similar to do the post. If you rather do multipart formposting there's a better example in http://curl.haxx.se/libcurl/c/multi-post.html

I suspect that I could use the easy read callback to do the context processing for each response received, so I might revisit it looking at that approach.

Yes you should! How else would you do it? I figure you can also store the response in a file and wait until the entire thing has been received and then handle it - it's really up to you, libcurl provide the means and you can decide which way to do it.

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to