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).
SocketAddrV4
struct SocketAddrV4
Represents an IPv4 socket address: an IPv4 address and a port.
Implemented traits
AnyType,
Copyable,
Deinitable,
Equatable,
Hashable,
ImplicitlyCopyable,
Movable,
Writable
Methods
__init__
def __init__(out self, ip: Ipv4Addr, port: UInt16)
Constructs a socket address from an IPv4 address and a port.
Args:
ip
port
def port(self) -> UInt16
Returns the port number.
Returns:
UInt16: The port number in host byte order.
write_to
def write_to(self, mut writer: T)
Writes the socket address as address:port, such as 127.0.0.1:8080.
Args:
- writer (
T): The writer to write to.