getaddrinfo

public func getaddrinfo(Pointer[UInt8], Pointer[UInt8], Pointer[UInt8], Pointer[Pointer[UInt8]]) -> Int32

Wraps getaddrinfo(3) — DNS / service-name resolution.

Resolves node (hostname or numeric address) and service (service name or port string) to a linked list of addrinfo records, written through res. hints constrains the result (family, socket type, protocol). Returns 0 on success or a non-zero EAI_* code on failure (note: not an errno). The caller must free the list with freeaddrinfo.

addrinfo struct layout (macOS, 48 bytes)

offset 0: ai_flags (i32) offset 4: ai_family (i32) offset 8: ai_socktype (i32) offset 12: ai_protocol (i32) offset 16: ai_addrlen (u32) offset 20: padding (4 bytes on macOS, differs from Linux) offset 24: ai_canonname (ptr) offset 32: ai_addr (ptr) offset 40: ai_next (ptr)

Defined in lang/std/net/libc.ks