curl-library
Re: How could i known the real IP address
Date: Thu, 6 Dec 2007 14:16:09 +0200
On Dec 6, 2007 1:05 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 5 Dec 2007, Bruce Peng wrote:
>
> > I'm trying to download file from a http server using libcurl. The domain
> > name in the URL will be redirect to different IP address each time. How
> > could i known the IP address while using libcurl to connect to the server?
> > someone knowns it?
>
> There's no "proper" way to extract the exact IP address, since libcurl
> provides no API to get it. It has been mentioned a lot of times but nobody
> every added it.
>
> curl_easy_getinfo( CURLINFO_EFFECTIVE_URL ) can often be used for that info.
There is an API to get the socket, if I am correct.
Since this is a TCP socket for most cases,
there is some platform-dependent API to find the peer's IP, like
getpeerbyname, etc
-- Sincerely, Robert Iakobashvili, coroberti %x40 gmail %x2e com ........................................................... http://curl-loader.sourceforge.net An open-source web testing and traffic generation.Received on 2007-12-06