curl-and-python

Re: pyCurl : get IP address of the peer socket

From: Mark Eichin <eichin_at_gmail.com>
Date: Mon, 8 Sep 2008 22:59:34 -0400

Haven't tried it, but it looks like calling socket.fromfd on that
integer should get you a pythonic-socket object wrapper that you can
call getpeername on...

---------- Forwarded message ----------
From: ferrety ferrety <yferrety_at_gmail.com>
Date: Mon, Sep 8, 2008 at 6:52 PM
Subject: pyCurl : get IP address of the peer socket
To: curl-and-python_at_cool.haxx.se

Hi List,

I'd like to know how to get the "IP address" of the peer socket when
downloding a URL with pycurl.

After a bit of googling, I found this:
 sock = curl.getinfo(pycurl.LASTSOCKET);

But it's seems to only return a socket file descriptor which is an integer.
What I'd like to have is a full python "socket" object to use it like this:

ipaddr, port = sock . getpeername()

Advices please?

Thanks in advance

cheers
Ferret
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python

-- 
_Mark_ <eichin_at_thok.org> <eichin_at_gmail.com>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2008-09-09