SOCKET_GETNAMEINFO(1p) User Contributed Perl Documentation SOCKET_GETNAMEINFO(1p)NAME
"socket_getnameinfo" - command-line tool to "getnameinfo(3)" resolver
SYNOPSIS
socket_getnameinfo [options...] address port
DESCRIPTION
This tool provides a convenient command-line wrapper around the getnameinfo(3) resolver function. It will perform a single reverse lookup
to convert an address and port number into its host and service names. This is mainly useful when debugging names resolution problems,
because it allows inspection of the getnameinfo(3) behaviour itself, outside of any real program that is trying to use it.
OPTIONS --address, -A ADDR
Numerical form of address to look up. If not supplied, will use the first positional argument.
--port, -P PORT
Port number to look up. If not supplied, will use the second positional argument.
--dgram Sets the "NI_DGRAM" flag; looks up a "SOCK_DGRAM" (udp) port allocation rather than "SOCK_STREAM" (tcp).
--help Display a help summary and exit
NOTE
Upstream this script is known as "getnameinfo", but was renamed on Debian.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-06-08 SOCKET_GETNAMEINFO(1p)
Check Out this Related 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)
Hi everyone,
I need some tool or a hint how to code it myself. I want a tool that listenes to a TCP/IP port and reads everything from that port and write it to a logfile.
How can I do this?
Regards,
Steff (3 Replies)
Hi all,
Situation is as below.
I would get an IP address and port from eithe r a file or command line. It probably would be as char * or string. So was wondering how I could accept this and increment the last octets?
Incrementing the port is fine. I could get that into an integer by atoi()... (8 Replies)
I'm trying to write a function to get the host name of any given IP address.
I'm trying to follow this manual but I'm stuck. I'm using gcc and Linux. Any ideas?
getnameinfo()
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
char... (6 Replies)
Gurus,
I am relatively new to Unix scripting and am struck with a problem in my script. I have positional input file which has a FLAG indicator in at position 11 in every record of the file.
If the Flag has value =Y, then the record from the input needs to be written to a new file.However if... (3 Replies)