cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Use of multi interface of libcurl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 30 Dec 2010 16:44:22 +0100 (CET)

On Thu, 30 Dec 2010, amit paliwal wrote:

>>> curl_easy_setopt( ctx , CURLOPT_URL, "http://localhost:4433" ) ;
>>> curl_easy_setopt( ctx , CURLOPT_INTERFACE, "127.0.0.1" ) ;
>>> curl_easy_setopt( ctx , CURLOPT_LOCALPORT, 4434 );
>>
>> Can you please explain to us the logic and reason for these two latter
>> options in combination with that URL?
>
> I am running Server and Client on same machine and they are communicating on
> loopback. As per the document CURLOPT_URL is mandatory for
> curl_easy_perform, I have mentioned it and have given localhost port 4433,
> where server is listening.
>
> Client is binded on port 4434, yesterday Daniel mentioned that
> CURLOPT_INTERFACE is used for client to bind on local port, so my client is
> binded on port 4434.

Why bind the local port at all? You're only asking for trouble by binding it
to a single specific port and if you don't have a good reason for doing it,
then you should not do it.

>> you need to it with another curl handle.

> That sounds logical, I guessed it and thanks for the clear response. In this
> case how will I send second GET request, if I am not wrong then I need to
> call curl_easy_perform() every time I need to send a GET request, is it
> right?

http://curl.haxx.se/libcurl/c/curl_easy_perform.html
http://curl.haxx.se/libcurl/c/libcurl-easy.html

> By providing readcb, will I be able to send GET with my custom data???

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-30