cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Use of multi interface of libcurl

From: amit paliwal <amit.ambitions_at_gmail.com>
Date: Thu, 30 Dec 2010 11:06:01 -0500

On Thu, Dec 30, 2010 at 10:44 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> 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.
>
> I will try without this.

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

I have seen this documentation and wrote sample code by this only, but I
don't know somehow my readcb is not getting called. I added one printf()
statement just to check whether readcb is called or not, but it never
happens. Whenevr we do curl_easy_perform() will it be sending a GET message
to Server? I have observed that some GET request goes to my test server. I
am sure I am missing something and need help from you to fix it.

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

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