cURL / Mailing Lists / curl-library / Single Mail

curl-library

Is there an easy way to separate request / response processing with libCurl?

From: <burt_at_burtbicksler.com>
Date: Fri, 27 Jan 2012 09:38:56 -0700
Hi,

We have an application that monitors several hardware devices connected by USB.  This application's primary task is to service the devices.

We have to interface with a Web Server that is running on the local machine, and the Web application developers are somewhat clueless about interacting with hardware devices.  Since they were already interacting with another hardware device via USB serial we originally proposed a simple TCP/IP connection to allow them to send notifications and requests and for returning data, and we have a working example.

But they seem to be resistant to this approach even though it is the cleanest, and is similar to what they are already doing.

So we are changing to use HTTP sending POST requests to them and receiving responses back by HTTP.

Since the Web Application has a different priority, servicing the users for example, they tend to take their own sweet time responding to requests (in terms of hardware processing times).  So we need to issue the request and continue doing processing of other hardware before we get the response from the Web Application.  In our world most of the processing will be done in under a couple of hundred milliseconds, while the Web Application is taking a number of seconds to respond.

So we are splitting the request and response processing, and ultimately using select to process the read fd(s) for the HTTP connection(s).  Our current simple HTTP client works well but I would prefer to use libCurl to get the HTTPS support (another annoyance is that they insist on HTTPS even though everything is running on the same computer inside a locked box ;)).

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'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.

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.

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.

Thanks,
Burt

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-27