cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Connections & Handles

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 29 Jan 2009 16:38:24 +0100 (CET)

On Thu, 29 Jan 2009, David Colter wrote:

> My question is a general one about the use of connections. I frequently
> target 10-20 individual pages in my php scripts. Sometimes it is only
> directed to 1 host, and more often toward 3 to 4 hosts ( sub domains ). As I
> have been unable to find definitive discussions about this, what is the best
> practice for using connections and handles? As a matter of background, the
> script must jump around the ( back & forth ) 3-4 hosts as it obtains cookies
> and redirects during/ after logging in.
>
> Should I configure the setopt's to use a different handle & different
> connections for each sub domain? Can I safely get by with 1 connection & 1
> handle when getting miltiple pages within one host. Does cookie parsing
> depend ( change ) because of connections & handles?

I'm assuming you make all the requests in a serial sequence? Then you should
re-use the same single handle for all transfers as far as possible, as the
underlying libcurl can then re-use the connections as far as possible so that
subsequent requests done to the same host that was previously used will not
have to use fresh TCP connect.

-- 
  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-01-29