cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to cleanly close the curl socket in case of multi interface?

From: nikhil ap <niks3089_at_gmail.com>
Date: Mon, 29 Sep 2014 16:27:46 +0530

>
> How will know for which *TCP* connection an easy handle is used?
>

"libcurl doesn't expose connections much and there's no way to identify a
certain connection anyway with like an ID or something. "

Since it is absolutely required that I should know which TCP connection an
easy handle is used for and to have a single easy handle cache a single
connection or linked to a single connection in a multi
interface environment, I would like to modify libcurl and have a private
version of libcurl linked to my program.

When an easy handle is set up for the first time I use
"CURLOPT_FORBID_REUSE" this will create a new TCP and a new socket. For
subsequent transfers on the same connection, I would like to use the same
easy handle that set this connection up. So when I run 100 connections in
parallel, I will have 100 easy handles dedicated for each connection that
should do transfers for only those connections.

Is there quick way to achieve this? I tried setting MAX_SOCKSPEREASYHANDLE
to 1 from 5. This still does not get the job done.
This ideally should mean 1:1 mapping between socket/tcp connection and easy
handle correct? How come it doesn't work?

Is there any other way to do this?

On Sun, Sep 21, 2014 at 9:30 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Sun, 21 Sep 2014, nikhil ap wrote:
>
> ConnInfo according to me is a TCP connection object which defined by
>> <soure ip, dest ip, source port, dest port> and should have just a single
>> socket attached to it.
>>
>
> libcurl does its separation based on the name used in the URL though, not
> IP address.
>
> Why I need to maintain connection level stats and bother about connection?
>> Simple answer, it's a requirement! :-)
>>
>
> The question was why you have such a weird requirement. But I guess it
> really doesn't matter.
>
> How will know for which *TCP* connection an easy handle is used?
>>
>
> libcurl doesn't expose connections much and there's no way to identify a
> certain connection anyway with like an ID or something.
>
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-- 
niks

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-09-29