GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SOCKET::GETADDRINFO::SOCKET6API (3)

.ds Aq ’

NAME

"Socket::GetAddrInfo::Socket6api" - Provide Socket::GetAddrInfo functions using Socket6 API

CONTENTS

SYNOPSIS



 use Socket qw( AF_UNSPEC SOCK_STREAM );
 use Socket::GetAddrInfo::Socket6api qw( getaddrinfo getnameinfo );

 my $sock;

 my @res = getaddrinfo( "www.google.com", "www", AF_UNSPEC, SOCK_STREAM );

 die "Cannot resolve name - $res[0]" if @res == 1;

 while( @res >= 5 ) {
    my ( $family, $socktype, $protocol, $addr, undef ) = splice @res, 0, 5, ();

    $sock = IO::Socket->new();
    $sock->socket( $family, $socktype, $protocol ) or
      undef $sock, next;

    $sock->connect( $addr ) or undef $sock, next;

    last;
 }

 if( $sock ) {
    my ( $host, $service ) = getnameinfo( $sock->peername );
    print "Connected to $host:$service\n" if defined $host;
 }



DESCRIPTION

Socket::GetAddrInfo provides the functions of getaddrinfo and getnameinfo using a convenient interface where hints and address structures are represented as hashes. Socket6 also provides these functions, in a form taking and returning flat lists of values.

This module wraps the functions provided by Socket::GetAddrInfo to provide them in an identical API to Socket6. It is intended to stand as a utility for existing code written for the Socket6 API to use these functions instead.

FUNCTIONS

CW@res = getaddrinfo( CW$host, CW$service, CW$family, CW$socktype, CW$protocol, CW$flags )

This version of the API takes the hints values as separate ordered parameters. Unspecified parameters should be passed as 0.

If successful, this function returns a flat list of values, five for each returned address structure. Each group of five elements will contain, in order, the family, socktype, protocol, addr and canonname values of the address structure.

If unsuccessful, it will return a single value, containing the string error message. To remain compatible with the Socket6 interface, this value does not have the error integer part.

( CW$host, CW$service ) = getnameinfo( CW$addr, CW$flags )

This version of the API returns only the host name and service name, if successfully resolved. On error, it will return an empty list. To remain compatible with the Socket6 interface, no error information will be supplied.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SOCKET::GETADDRINFO::SOCKET6API (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.