Name
SPVM::IO::Socket - Socket Communications
Usage
use IO::Socket;
use Sys::Socket::Constant as SOCKET;
# Create a new AF_INET socket
my $io_socket= IO::Socket->new({Domain => SOCKET->AF_INET});
# Create a new AF_INET6 socket
my $io_socket= IO::Socket->new({Domain => SOCKET->AF_INET6});
# Create a new AF_UNIX socket
my $io_socket= IO::Socket->new({Domain => SOCKET->AF_UNIX});
Description
SPVM::IO::Socket provides socket communications.
Parent Class
Fields
timeout
has timeout : protected ro int;
sockdomain
has sockdomain : protected ro int;
socktype
has socktype : protected ro int;
protocol
has protocol : protected ro int;
peername
has peername : protected ro Sys::Socket::Sockaddr;
See also Sys::Socket::Sockaddr.
fd
has fd : protected int;
listen_backlog
has listen_backlog : protected int;
Class Methods
new
static method new : IO::Socket ($options = undef : object[]);
new Options
Timeout : Int
Domain : Int
Type : Int
Blocking : Int
Listen : Int
See also SPVM::Sys::Socket::Constant.
Instance Methods
new_instance
method new_instance : IO::Socket ($options = undef : object[]);
DESTROY
method DESTROY : void ();
init
protected method init : void ($options = undef : object[]);
connect
method connect : int ($address : Sys::Socket::Sockaddr);
See also Sys::Socket::Sockaddr.
recv
method recv : int ($buffer : mutable string, $length = -1 : int, $flags = 0 : int);
send
method send : int ($buffer : string, $flags = 0 : int, $to = undef : Sys::Socket::Sockaddr);
See also Sys::Socket::Sockaddr.
close
method close : int ();
fileno
method fileno : int (); return $self->{fd}; }
opened
method opened : int ();
listen
method listen : int ($queue = 5 : int);
bind
method bind : int ($address : Sys::Socket::Sockaddr);
See also Sys::Socket::Sockaddr.
sockname
method sockname : Sys::Socket::Sockaddr ();
See also Sys::Socket::Sockaddr.
shutdown
method shutdown : int ($sockfd : int, $how : int);
atmark
method atmark : int ();
setsockopt
method setsockopt : int ($level : int, $optname : int, $optval : int);
getsockopt
method getsockopt : int ($level : int, $optname : int);
connected
method connected : Sys::Socket::Sockaddr ();
See also Sys::Socket::Sockaddr.
socket
method socket : int ($domain : int, $type : int, $protocol = 0 : int);
socketpair
method socketpair : int[] ($domain : int, $type : int, $protocol : int);
accept
method accept : IO::Socket ($io_socket_builder = undef : IO::Socket::Builder, $peer_ref = undef : Sys::Socket::Sockaddr[]);
See also Sys::Socket::Sockaddr.
See also IO::Socket::Builder.
See Also
Sys::Socket
Sys::Socket::Constant
IO::Socket::INET
Perl's IO::Socket
IO::Socket
is a Perl's IO::Socket porting to SPVM.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License