cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: About receiving data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 2 Apr 2008 13:28:27 +0200 (CEST)

On Wed, 2 Apr 2008, Prasad J Pandit wrote:

> 1. How do I receive data? (considering, I'm not the one who opens the
> connection and have access to the socket)

You seem to have missed the tutorial:

         http://curl.haxx.se/libcurl/c/libcurl-tutorial.html

and the examples:

         http://curl.haxx.se/libcurl/c/example.html

You use CURLOPT_WRITEFUNCTION.

> And secondly while sending data, my POST request url changes only by the
> resource name on the server, ie. my host remains same, as:
>
> + http://myhost.com/file1
> + http://myhost.com/file2
>
> Now can I, somehow, set a global host like CURLOPT_PORT and then everytime I
> do post I set the CURLOPT_URL to that resource name as "/file1/" or
> "/file2/" and expect libcurl to make it as: http://myhost.com/file1/ or
> http://myhost.com/file2/.

No. You need to construct the full URLs to pass to libcurl.

> Also, does libcurl opens new connection for every HTTP Get or Post I do, or
> how does it work?

If you re-use the easy handle libcurl will re-use connections as much as it
can.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-04-02