feat(udp): Udp.* - polled IPv4 datagrams on macOS and Windows

Udp.open/port/send/recv/from_ip/from_port/close/resolve/local_ip/ip/ip_text, native
BSD sockets (udp.ll) and Winsock (udp_win.ll, -lws2_32), linked only when a program
uses Udp.*; example, docs and tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-17 11:16:14 +03:00
parent 6a7f1dd393
commit ebb1a00352
24 changed files with 68630 additions and 66360 deletions

9
changes/udp-datagrams.md Normal file
View file

@ -0,0 +1,9 @@
bump: minor
type: feat
`Udp.*`: polled IPv4 datagrams - the transport under a game's own netcode. `Udp.open(port)`
binds a non-blocking socket (port 0 picks one, `Udp.port` says which), `Udp.send` sends one
datagram to an address and port, and `Udp.recv` drains what arrived without ever blocking;
`Udp.from_ip` / `Udp.from_port` name the sender. `Udp.ip` / `Udp.ip_text` convert addresses,
`Udp.resolve` looks a host name up and `Udp.local_ip` is the address a player on the same
network would dial. BSD sockets on macOS (`runtime/native/udp.ll`), Winsock on Windows
(`udp_win.ll`, linked with ws2_32), linked only into a program that uses `Udp.*`.