Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

socket::getaddrinfo::strict(3pm) [debian man page]

Socket::GetAddrInfo::Strict(3pm)			User Contributed Perl Documentation			  Socket::GetAddrInfo::Strict(3pm)

NAME
"Socket::GetAddrInfo::Strict" - Provide Socket::GetAddrInfo functions which throw exceptions SYNOPSIS
use Socket qw( SOCK_STREAM ); use Socket::GetAddrInfo::Strict qw( getaddrinfo getnameinfo ); use IO::Socket; my $sock; my %hints = ( socktype => SOCK_STREAM ); my @res = getaddrinfo( "www.google.com", "www", \%hints ); while( my $ai = shift @res ) { $sock = IO::Socket->new(); $sock->socket( $ai->{family}, $ai->{socktype}, $ai->{protocol} ) or undef $sock, next; $sock->connect( $ai->{addr} ) or undef $sock, next; last; } if( $sock ) { my ( $host, $service ) = getnameinfo( $sock->peername ); print "Connected to $host:$service "; } DESCRIPTION
Socket::GetAddrInfo provides the functions of "getaddrinfo" and "getnameinfo", which return lists whose first element is error value, or false indicating no error occured. This module wraps the functions provided by "Socket::GetAddrInfo" to check this error value, and throw an exception (using "die") if an error occured. If not, then the remaining values are returned as normal. This can simplify the logic of a program which otherwise simply throws its own exception on failure anyway. FUNCTIONS
@res = getaddrinfo( $host, $service, $hints ) After a successful lookup, returns the list of address structures, as documented in Socket::GetAddrInfo. If the lookup fails, an exception containing the string form of the error is thrown instead. ( $host, $service ) = getnameinfo( $addr, $flags, $xflags ) After a successful lookup, returns the host and service name, as documented in Socket::GetAddrInfo. If the lookup fails, an exception containing the string form of the error is thrown instead. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-06-08 Socket::GetAddrInfo::Strict(3pm)

Check Out this Related Man Page

Socket::Multicast6(3pm) 				User Contributed Perl Documentation				   Socket::Multicast6(3pm)

NAME
Socket::Multicast6 - Constructors and constants for IPv4 and IPv6 multicast socket operations. SYNOPSIS
use Socket::Multicast6 qw(:all); my $ip = getprotobyname( 'ip' ); my $ip_mreq = pack_ip_mreq( inet_aton( $mcast_addr ), inet_aton( $if_addr ) ); my $ipv6_mreq = pack_ipv6_mreq( inet_pton( AF_INET6, $mcast6_addr ), $if_index ); setsockopt( $sock, $ip, IP_ADD_MEMBERSHIP, $ip_mreq ) or die( "setsockopt IP_ADD_MEMBERSHIP failed: $!" ); setsockopt( $sock, $ip, IP_DROP_MEMBERSHIP, $ip_mreq ) or die( "setsockopt IP_DROP_MEMBERSHIP failed: $!" ); setsockopt( $sock, $ip, IP_MULTICAST_LOOP, pack( 'C', $loop ) ) or die( "setsockopt IP_MULTICAST_LOOP failed: $!" ); setsockopt( $sock, $ip, IP_MULTICAST_TTL, pack( 'C', $ttl ) ) or die( "setsockopt IP_MULTICAST_TTL failed: $!" ); DESCRIPTION
This module is used to gain access to constants and utility functions used when manipulating multicast socket attributes. For simple, object-oriented way of doing the same thing, take a look at IO::Socket::Multicast6 or IO::Socket::Multicast. EXPORTS
By default nothing is exported, you can use the 'ipv4', 'ipv6' and 'independent' to export a specific protocol family, or 'all' to export all symbols. FUNCTIONS
$ip_mreq = pack_ip_mreq(MCAST_ADDR, IF_ADDR) $ip_mreq_source = pack_ip_mreq_source(MCAST_ADDR, SOURCE_ADDR, IF_ADDR) $ipv6_mreq = pack_ipv6_mreq(MCAST6_ADDR, IF_INDEX) CONSTANTS
IP_MULTICAST_IF IP_MULTICAST_TTL IP_MULTICAST_LOOP IP_ADD_MEMBERSHIP IP_DROP_MEMBERSHIP IP_ADD_SOURCE_MEMBERSHIP IP_DROP_SOURCE_MEMBERSHIP IPV6_MULTICAST_IF IPV6_MULTICAST_HOPS IPV6_MULTICAST_LOOP IPV6_JOIN_GROUP IPV6_LEAVE_GROUP MCAST_JOIN_GROUP MCAST_BLOCK_SOURCE MCAST_UNBLOCK_SOURCE MCAST_LEAVE_GROUP MCAST_JOIN_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP SEE ALSO
IO::Socket::Multicast6 (The easier, object-oriented way) AUTHOR
Based on Socket::Multicast by Jonathan Steinert, <hachi@cpan.org> Socket::Multicast6 by Nicholas J Humfrey, <njh@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2006 Nicholas J Humfrey Copyright (C) 2006 Jonathan Steinert This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2011-11-15 Socket::Multicast6(3pm)
Man Page