cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl multi interface interleave GET and POST calls

From: Andrei Ionescu <andrei.ionescu_at_gmail.com>
Date: Mon, 31 Jan 2011 19:17:59 -0500

Hi,

I just started using libcurl since I need to talk to a HTTP server and
I figure it would be faster to use libcurl rather than write my own
HTTP layer on top of TCP. Previously I've been using just straight TCP
for communication between internal components where the sent data was
HTTP-ish, where the full protocol wasn't supported and I really didn't
need to be up to spec since I didn't need to communicate with any
external servers. My question here may be a very basic HTTP/libcurl
question but here is my situation:
- the client connects to the server and it can send data to it by issuing a POST
- the server will send data to the client in a POST, but only if the
client performed a GET to the server (if no data is available then it
will not respond immediately)

Can I use a single handle and pass it to libcurl's multi interface to
do all the above? The problem that I have is that I can't see a way of
sending both GETs and POSTs on a single handle without doing a
curl_easy_setopt on the handle which is now owned by the multi handle.
Am I stuck with having to open two connections to the server or am I
missing something obvious in libcurl?

Thanks,
Andrei.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-01