Name

SPVM::IO::Socket::IP::Import::IPv4 - Importable Methods for IPv4.

Description

IO::Socket::IP::Import::IPv4 interface in SPVM provides importable methods for IPv4.

Usage

use IO::Socket::IP::Import::IPv4;

Interface Methods

sockname

method sockname : Sys::Socket::Sockaddr ();

Returns Sys::Socket::Sockaddr object containing a local address and a local port.

The type of the returned value is Sys::Socket::Sockaddr::In.

This method must be implemented by the class that declares this interface.

peername

method peername : Sys::Socket::Sockaddr ();

Returns Sys::Socket::Sockaddr object containing a remote address and a local port.

The type of the returned value is Sys::Socket::Sockaddr::In.

This method must be implemented by the class that declares this interface.

sockaddr

method sockaddr : Sys::Socket::In_addr_base ();

Returns a local address.

The type of the returned object is Sys::Socket::In_addr.

sockhost

method sockhost : string ();

Returns a local host name.

sockport

method sockport : int ();

Returns a local port.

peeraddr

method peeraddr : Sys::Socket::In_addr_base ();

Returns a remote address.

The type of the returned object is Sys::Socket::In_addr.

peerhost

method peerhost : string ();

Returns a remote host name.

peerport

method peerport : int ();

Returns a remote port.

create_sockaddr

method create_sockaddr : Sys::Socket::Sockaddr ($address : string, $port : int);

Creates a Sys::Socket::Sockaddr object given the address $address and the port $port.

$address is allowed to be a domain name, a host name, an IP address.

The type of the returned value is Sys::Socket::Sockaddr::In.

Implementation:

This method resolves $address using Net::DNS::Native#getaddrinfo method in non-blocking way and creates a Sys::Socket::Sockaddr::In object from the resolved IP address and $port.

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License