POSIX::1003::Socket - POSIX constants and functions related to sockets
# SOCKET support use POSIX::1003::Socket; # load all names socket(Server, PF_INET, SOCK_STREAM, $proto); setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, 1); use POSIX::1003::Socket qw(SOCK_DGRAM); print SOCK_DGRAM; # constants are subs use POSIX::1003::Socket '%socket'; my $bits = $socket{SOCK_DGRAM}; $socket{SOCK_DGRAM} = $bits; print "$_\n" for keys %socket;
[added in release 0.99] This module provides access to the "socket" interface, especially a long list of constants starting with SO_, SOL_, SOCK_, AF_, and many more.
SO_
SOL_
SOCK_
AF_
The best way to work with sockets is via IO::Socket::IP. This module provides many more constants than those modules do, but currently does not export the functions as the other modules of this suite do.
The advantage of using the constants of this module, is that the list will be extended when new names are discovered, and then immediately available to older versions of Perl.
Many socket related functions are contained in Perl's core.
Returns the value for $opt (some SO_ constant). See also setsockopt().
Set the $value on $opt for the $socket.
There are a few minor tricks to make this function integrate better in Perl. Firstly, for the boolean OPTs SO_DONTROUTE, SO_KEEPALIVE, and SO_REUSEADDR the value is treated as a real Perl boolean.
SO_DONTROUTE
SO_KEEPALIVE
SO_REUSEADDR
SO_LINGER has three combinations. "Linger off" is reprensed by Other values mean "linger on" with a timeout. SO_RCVTIMEO and SO_SNDTIME get a timestamp in float.
SO_LINGER
SO_RCVTIMEO
SO_SNDTIME
Returns a list with all known names, unsorted.
This exported variable is a tied HASH which maps SO* and AF_* names to numbers, to be used with various socket related functions.
SO*
AF_*
The following constants where detected on your system when the module got installed. The second column shows the value which where returned at that time.
During installation, a symbol table will get inserted here.
This module is part of POSIX-1003 distribution version 0.99_05, built on March 18, 2015. Website: http://perl.overmeer.net. The code is based on POSIX, which is released with Perl itself. See also POSIX::Util for additional functionality.
Copyrights 2011-2015 on the perl code and the related documentation by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install POSIX::1003, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POSIX::1003
CPAN shell
perl -MCPAN -e shell install POSIX::1003
For more information on module installation, please visit the detailed CPAN module installation guide.