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

View file

@ -0,0 +1,23 @@
---
id: udp-open
name: Udp.open
category: udp
kind: namespace-method
tokens: Udp.open
sig: Udp.open(port) -> int
tip: Open a socket on a port.
order: 0
ns: Udp
member: open
---
Opens a non-blocking IPv4 socket bound to <code>port</code> on every interface and returns its handle, or <code>0</code> when it could not. Port <code>0</code> lets the system pick a free one; <a href="udp-port.html"><code>Udp.port</code></a> says which.
```ludic
program Demo {
entry {
let s = Udp.open(port: 0)
print(s > 0)
}
}
```