NAME
POSIX::Socket - Low-level perl interface to POSIX sockets
SYNOPSIS
use POSIX::Socket
my $rd=_socket(AF_INET, SOCK_DGRAM, 0) or die "socket: $!\n";
my $wr=_socket(AF_INET, SOCK_DGRAM, 0) or die "socket: $!\n";
my $addr = sockaddr_in(0, inet_aton("127.0.0.1"));
my $bind_rv=_bind($rd, $addr);
_getsockname($rd, $addr);
my ($port, $ip) = unpack_sockaddr_in($addr);
$ip = inet_ntoa($ip);
die "_getsockname fail!" unless $ip eq "127.0.0.1";
my $ret_val1 = _sendto($wr, $msg, $flags, $addr);
my $ret_val2 = _recv($rd, $buf, 8192, 0);
_close ($rd);
_close ($wr);
DESCRIPTION
The primary purpose of this is to use file descriptors instead of file handles for socket operations. File descriptors can be shared between threads and not need dup file handles for each threads.
I hope you enjoyed it.
EXPORT
All of the above
AUTHOR
Yury Kotlyarov yura@cpan.org