curl-library
Re: Getting the IP address of the site contacted
Date: Mon, 22 May 2006 21:39:08 -0700
On Mon, May 22, 2006 at 04:14:20PM -0700, Lenny Rachitsky wrote:
> I'm trying to figure out a reliable way to determine what IP address my
> libcurl download resolved to. I can't find a nice getinfo() request that will
> give this to me. Is there some other way I can figure out what IP address my
> request resolved to? I see it in the DEBUG output, but I'd prefer not to be
> parsing DEBUG output to get this.
>
> One thing I want to make sure I'm dealing with is DNS servers that return
> multiple IP addresses, where the local DNS caches more then one IP, and
> potentially rotates amongst those internally. I want to make sure I can get
> the exact IP address that the libcurl download contacted each time.
You could use CURLINFO_LASTSOCKET and then getsockname(2), but that's unlikely
to work if the connection was closed. I thought I heard a similar
question here last year, but I don't recall the resolution.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2006-05-23