For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
SocketAddrV6
struct SocketAddrV6
Represents an IPv6 socket address.
Implemented traits
AnyType,
Copyable,
Deinitable,
Equatable,
Hashable,
ImplicitlyCopyable,
Movable,
Writable
Methods
__init__
def __init__(out self, ip: Ipv6Addr, port: UInt16, flowinfo: UInt32 = UInt32(0), scope_id: UInt32 = UInt32(0))
Constructs a socket address from an IPv6 address and a port.
Args:
ip
port
def port(self) -> UInt16
Returns the port number.
Returns:
UInt16: The port number in host byte order.
flowinfo
def flowinfo(self) -> UInt32
Returns the flow information.
This is the sin6_flowinfo field of C's struct sockaddr_in6, from
RFC 2553, section 3.3. It isn't just the flow label: its 32 bits
combine the 20-bit flow label and the 8-bit traffic class, which
RFC 8200 defines in sections 6 and 7.
Returns:
UInt32: The flow information.
scope_id
write_to
def write_to(self, mut writer: T)
Writes the socket address as [address]:port, such as [::1]:8080.
A nonzero scope ID follows the address after a %, such as
[fe80::1%2]:8080. The flow information isn't written.
Args:
- writer (
T): The writer to write to.