ludic/docs/language/udp/udp-send.md
Orkuncakilkaya ebb1a00352 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>
2026-09-17 11:16:14 +03:00

609 B

id name category kind tokens sig tip order ns member
udp-send Udp.send udp namespace-method Udp.send Udp.send(socket, ip, port, bytes, len) -> int Send one datagram. 2 Udp send

Sends the first len bytes of bytes to ip:port as one datagram and returns the number of bytes sent, or -1.

program Demo {
  entry {
    let s = Udp.open(port: 0)
    let buf = Memory.bytes(4)
    Memory.poke(buf, 0, 1)
    print(Udp.send(socket: s, ip: Udp.ip(text: "127.0.0.1"), port: Udp.port(socket: s), bytes: buf, len: 1))
  }
}