On 10 Dec 2003, at 20:25, Chris Ridd wrote:
On 10/12/03 7:58 pm, D.Kreft <[EMAIL PROTECTED]> wrote:

On Wed, 10 Dec 2003, Chris Ridd did scribble:

$ldap->socket->peername returns the peer address and port. $ldap->socket's
documented as well ;-)

I just grepped the perldocs for Net::LDAP (v0.2701) and didn't see any mention of 'peername' or 'socket'. Am I missing something, or has documentation for this little "trick" been added since 0.2701?

Good point - I'm using 0.30. The socket method existed in 0.2701 (I just
checked), but wasn't documented until more recently (I didn't check when).
It returns an IO::Socket object, which you can call peername on:


my ($port,$iaddr) = sockaddr_in($ldap->socket->peername);
my $peerhost = gethostbyaddr($iaddr, AF_INET);
my $peerstraddr = inet_ntoa($iaddr);

Or just


$ldap->socket->peerhost;

Thats providing the socket is one of IO::Socket::INET, but the result will be a dotted-quad, not a readable hostname :(

Graham.



Reply via email to