Socket-Class
view release on metacpan or search on metacpan
version 1.12
- version style changed
- "new()" now sets correct error code on failure
- added "listen" to the documentation.. sorry :)
- fixed test scripts on darwin
version 1.1.1
- added cascading to internal resource storage for better performance on
higher number of used sockets
- fixed inet6 on older versions of win32
version 1.1.0
- added function "get_hostaddr"
- function "readline" now returns new line characters also
- !!! removed socket by reference destruction when using threads,
!!! it wont work right in some cases. it is safer to free the socket
!!! explictly.
- added detection of "new standard network functions" on win32
- improved return parameters in xs functions
- added support for perl5.6.2
version 1.0.7
- fixed snprintf on win32
- fixed socket by reference destruction when using with threads
version 1.0.6
- documentation updated
- fixed socket settings for parameters 'local_path' and 'remote_path'
in constructor function new()
version 1.0.5
- fixed testscript for inet6
- changed internal file structure
version 1.0.4
- added function "select"
- added examples to examples/*
- fixed broken internal mutex handling
- fixed internal error handling
version 1.0.3
- bug on Windows Vista is fixed
key-value pairs.
=for formatter none
remote_addr Remote host address <hostname> | <hostaddr>
remote_port Remote port or service <service> | <number>
remote_path Remote path for unix sockets "/tmp/mysql.sock"
local_addr Local host bind address <hostname> | <hostaddr>
local_port Local host bind port <service> | <number>
local_path Local path for unix sockets "/tmp/myserver.sock"
domain Socket domain name (or number) "inet" | "inet6" | ...
proto Protocol name (or number) "tcp" | "udp" | ...
type Socket type name (or number) "stream" | "dgram" | ...
listen Put socket into listen state with a specified maximal
number of connections in the queue
broadcast Set SO_BROADCAST before binding
reuseaddr Set SO_REUSEADDR before binding
blocking Enable or disable blocking mode; default is enabled
timeout Timeout value for various operations as floating point
number;
defaults to 15000 (15 seconds); currently used by connect
Binds the socket to a specified local address.
B<Parameters>
I<$addr> or I<$path>
On 'inet' family sockets the I<$addr> parameter can be an IP address in
dotted-quad notation (e.g. 127.0.0.1) or a valid hostname.
On 'inet6' family sockets the I<$addr> parameter can be an IPv6 address in
hexadecimal notation (e.g. 2001:0db8:85a3:08d3:1319:8a2e:0370:7344) or a
valid hostname.
On 'unix' family sockets the I<$path> is the pathname of a Unix domain socket.
If I<$addr> is not defined the address from last I<bind> is used.
I<$port>
The I<$port> parameter designates the port or channel on the local host.
Initiates a connection.
B<Parameters>
I<$addr> or I<$path>
On 'inet' family sockets the I<$addr> parameter can be an IP address in
dotted-quad notation (e.g. 127.0.0.1) or a valid hostname.
On 'inet6' family sockets the I<$addr> parameter can be an IPv6 address in
hexadecimal notation (e.g. 2001:0db8:85a3:08d3:1319:8a2e:0370:7344) or a
valid hostname.
On 'unix' family sockets the I<$path> is the pathname of a Unix domain socket.
If I<$addr> is not defined the address from last I<connect> is used.
I<$port>
The I<$port> parameter designates the port or service on the remote host to
sc_bluez.c
sc_bluez.h
sc_mod_def.c
sc_mod_def.h
sc_ws2bth.c
sc_ws2bth.h
socket_class.c
socket_class.h
examples/bigdata_client.pl
examples/bigdata_server.pl
examples/inet6_nonblocking.pl
examples/inet_blocking.pl
examples/inet_dgram_ping.pl
examples/inet_nonblock_10clients.pl
examples/ping_client.pl
examples/ping_server.pl
examples/traceroute.pl
examples/unix_blocking.pl
t/0_basic.t
t/1_inet.t
t/2_inet6.t
t/3_unix.t
t/4_threads.t
xs/Makefile.PL
xs/sc_const/Const.pm
xs/sc_const/Const.pod
xs/sc_const/Const.xs
xs/sc_const/Makefile.PL
xs/sc_ssl/CTX.pod
xs/sc_ssl/install_files.PL
examples/inet6_nonblocking.pl view on Meta::CPAN
use Time::HiRes;
use Socket::Class;
sub say { print @_, "\n"; }
our $RUNNING : shared = 1;
$o = select STDOUT; $| = 1; select $o;
$server = Socket::Class->new(
'domain' => 'inet6',
'local_addr' => '::1',
'listen' => 5,
'blocking' => 0,
) or die Socket::Class->error;
threads->create( \&server_thread, $server );
$client = Socket::Class->new(
'domain' => 'inet6',
'remote_addr' => '::1',
'remote_port' => $server->local_port,
'blocking' => 0,
) or die Socket::Class->error;
threads->create( \&client_thread, $client );
our $client_count = 0;
our $client_ts : shared = µtime();
t/2_inet6.t view on Meta::CPAN
require Socket::Class;
import Socket::Class qw(:all);
#if( $Socket::Class::OLDNET ) {
# _skip_all();
# goto _end;
#}
$sock = Socket::Class->new(
'domain' => 'inet6',
) or warn Socket::Class->error;
if( ! $sock ) {
_skip_all();
goto _end;
}
_check( $sock );
$r = $sock->bind( '::1', 0 )
or warn "Error: " . $sock->error;
( run in 0.300 second using v1.01-cache-2.11-cpan-5f2e87ce722 )