union io.SocketAddress

Overview

This union is a container for both IP4 and IP6 addresses. More…

import "io_base.jncx"
import "io_SocketAddress.jnc"

union SocketAddress {
    // fields

    io.SocketAddress_ip4 m_ip4;
    io.SocketAddress_ip6 m_ip6;

    // methods

    bool isEqual(io.SocketAddress const* addr) const;
    bool isMatch(io.SocketAddress const* filterAddress) const;
    bool errorcode parse(string_t string);
    string_t getString() const;

    // aliases

    alias toString = getString;
};

Detailed Documentation

This union is a container for both IP4 and IP6 addresses.

All methods and/or properties of io.Socket class which accept or return addresses, use io.SocketAddress arguments.

Fields

io.SocketAddress_ip4 m_ip4

Holds IP4 socket address as io.SocketAddress_ip4.

io.SocketAddress_ip6 m_ip6

Holds IP6 socket address as io.SocketAddress_ip6.

Methods

bool isEqual(io.SocketAddress const* addr) const

Checks two socket addresses for equality; returns true if addresses are equal and false otherwise.

bool isMatch(io.SocketAddress const* filterAddress) const

Checks two socket addresses for matching. See io.SocketAddress_ip4.isMatch or io.SocketAddress_ip6.isMatch for definition of the term match.

Returns true if addresses match and false otherwise.

bool errorcode parse(string_t string)

Constructs the address from a string representation in string argument.

Returns true if address string was parsed successfully. Otherwise, sets the description of parsing error and returns false [1].

string_t getString() const

Creates and returns a string representation of the address.

Aliases

alias toString = getString

Effectively makes io.SocketAddress a stringable class.


Footnotes