Skip to main content

patch_seq_udp_send_to

Function patch_seq_udp_send_to 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_udp_send_to(stack: Stack) -> Stack
Expand description

Send a datagram to a host:port from a bound UDP socket.

Stack effect: ( bytes host port socket – Bool )

Pops socket, port, host, bytes (in that order, so bytes is below all of them on entry). Returns false on type mismatch, invalid socket, address-resolution failure, or send error.

Host resolution goes through dns::resolve (the may-aware DNS worker pool from PR1). Previously this path used format!("{host}:{port}") + may’s ToSocketAddrs, which silently called blocking getaddrinfo on the calling may carrier whenever host was a DNS name — a latent hazard that PR5 closes. IP literals still work; they round-trip through the resolver’s numeric-host fast path. If resolution returns multiple addresses (e.g. localhost → ::1, 127.0.0.1) we try them in order and stop at the first send_to that doesn’t error.

§Safety

Stack must have Int (socket), Int (port), String (host), String (bytes) — top-down — on entry.