Skip Menu |
 

This queue is for tickets about the Socket CPAN distribution.

Report information
The Basics
Id: 76010
Status: resolved
Priority: 0/
Queue: Socket

People
Owner: Nobody in particular
Requestors: dkg [...] fifthhorseman.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.94_03
Fixed in: 2.001



Subject: inet_pton does not work with hostnames (despite documentaton otherwise)
Socket.pm in my debian perl 5.14 installation says: inet_pton ADDRESS_FAMILY, HOSTNAME Takes an address family, either AF_INET or AF_INET6, and a string giving the name of a host, and translates that to an opaque string (if programming in C, struct in_addr or struct in6_addr depending on the address family passed in). The host string may be a string hostname, such as 'www.perl.org', or an IP address. If using an IP address, the type of IP address must be consistent with the address family passed into the function. However, using a hostname does not work (in contrast to inet_aton, where it does work): 0 dkg@pip:~$ perl -MSocket -e 'printf("xx: %s\n", unpack("H*", Socket::inet_aton("www.perl.org")));' xx: cfab0733 0 dkg@pip:~$ perl -MSocket -e 'printf("xx: %s\n", unpack("H*", Socket::inet_pton(AF_INET, "www.perl.org")));' xx: 0 dkg@pip:~$ given that the underlying libc inet_pton() doesn't accept hostnames (only ascii represenations ofIP addresses), perhaps it would be better to just remove the claim from perl's documentation.
Download (untitled) / with headers
text/plain 424b
On Sat Mar 24 01:27:53 2012, DKG wrote: Show quoted text
> given that the underlying libc inet_pton() doesn't accept hostnames > (only ascii represenations ofIP addresses), perhaps it would be better > to just remove the claim from perl's documentation.
Ahyes, given as the XS wrapper is a fairly trivial wrapper around the libc function, it has the same abilities. I'll update the documentation to point this out. Thanks, -- Paul Evans
Released as 2.001 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.