Name
SPVM::IO::Socket::INET - IPv4 Socket
Usage
use IO::Socket::INET;
use Sys::Socket;
use Sys::Socket::Constant as SOCKET;
# Socket
my $host = "google.com";
my $port = 80;
my $io_socket = IO::Socket::INET->new({
PeerAddr => $host,
PeerPort => $port
});
my $io_socket = IO::Socket::INET->new({
PeerAddr => 'www.perl.org',
PeerPort => 80,
Proto => SOCKET->IPPROTO_TCP
});
my $io_socket = IO::Socket::INET->new({
Listen => 5,
LocalAddr => 'localhost',
LocalPort => 9000,
Proto => SOCKET->IPPROTO_TCP
});
my $io_socket = IO::Socket::INET->new({
PeerPort => 9999,
PeerAddr => Sys::Socket->inet_ntoa(SOCKET->INADDR_BROADCAST),
Proto => SOCKET->IPPROTO_UDP,
LocalAddr => 'localhost',
Broadcast => 1
})
Description
IO::Socket::INET
provides IPv4 Socket.
Super Class
Fields
peer_address
has peer_address : string;
peer_port
has peer_port : int;
local_address
has local_address : string;
local_port
has local_port : int;
proto_number
has proto_number : int;
Class Methods
new
static method new : IO::Socket::INET ($options : object[] = undef);
new Options
ReuseAddr : string
ReusePort : Int
Broadcast : Int
PeerAddr : string
PeerPort : Int
LocalAddr : string
LocalPort : Int
Proto : Int
Timeout : Int
Domain : Int
Type : Int
Blocking : Int
Listen : Int
Instance Methods
init
protected method init : void ($options : object[] = undef);
sockaddr
method sockaddr : Sys::Socket::In_addr ();
sockport
method sockport : int ();
sockhost
method sockhost : string ();
peeraddr
method peeraddr : Sys::Socket::In_addr ();
peerport
method peerport : int ();
peerhost
method peerhost : string ();
See Also
Perl's IO::Socket::INET
IO::Socket::INET
is a Perl's IO::Socket::INET porting to SPVM.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License