Represents an IPv4 socket address, consisting of an IPv4 address and a port number.
const socketAddr = new SocketAddrV4({port: 6372}); // new SocketAddrV4({addr: Ipv4Addr.UNSPECIFIED, port: 6372});tcpServer.listen(socketAddr.asNodeListenerOptions(), () => {});udpSocket.bind(socketAddr, () => {});tcpServer.listen({...socketAddr.asNodeListenerOptions(), ipv6Only: true}, () => {}); Copy
const socketAddr = new SocketAddrV4({port: 6372}); // new SocketAddrV4({addr: Ipv4Addr.UNSPECIFIED, port: 6372});tcpServer.listen(socketAddr.asNodeListenerOptions(), () => {});udpSocket.bind(socketAddr, () => {});tcpServer.listen({...socketAddr.asNodeListenerOptions(), ipv6Only: true}, () => {});
v0.0.1
Creates a new SocketAddrV4 instance.
SocketAddrV4
The options for creating the socket address.
Optional
The IPv4 address. Defaults to Ipv4Addr.UNSPECIFIED.
The port number.
Readonly
Returns an object suitable for use as options in Node.js net.Server.listen() method.
net.Server.listen()
An object containing the port and host properties.
port
host
Gets the raw Ipv4Addr instance representing the IP address of this socket address.
Ipv4Addr
Ipv4Addr instance of the socket address's IP address.
Returns a string representation of this socket address.
The string representation in the format "address:port".
Represents an IPv4 socket address, consisting of an IPv4 address and a port number.
Example
Since
v0.0.1