Name
SPVM::IO::Socket::UNIX - Short Description
Description
The IO::Socket::UNIX class in SPVM has methods for someting.
Usage
use IO::Socket::UNIX;
use Sys::Socket;
use Sys::Socket::Constant as SOCKET;
# Client
my $socket_path = "my_socket.sock";
my $io_socket = IO::Socket::UNIX->new({
Peer => $socket_path,
});
# Server
my $socket_path = "my_socket.sock";
my $io_socket = IO::Socket::UNIX->new({
Local => $socket_path,
Listen => 5,
});
Fields
Local
has Local : string;
A local path.
Peer
has Peer : string;
A peer path.
Class Methods
new
static method new : IO::Socket::UNIX ($options : object[] = undef);
Creates a new IO::Socket::UNIX object.
And creates a Unix domain socket.
And if "Peer" field is defined, connect is executed.
And if "Local" field is defined, bind and listen are executed.
And returns the new object.
Options:
The following options are available adding the options for IO::Socket#new method are available.
Instance Methods
hostpath
method hostpath : string ();
peerpath
method peerpath : string ();
accept
method accept : IO::Socket::UNIX ($peer_ref : Sys::Socket::Sockaddr[] = undef);
Calls accept method of its super class given the argument given to this method and returns its return value.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License