ludic/docs/language/udp/udp-open_local.md

663 B

id name category kind tokens sig tip order ns member
udp-open_local Udp.open_local udp namespace-method Udp.open_local Udp.open_local(port) -> int Open a socket only this machine can reach. 0 Udp open_local

Opens a non-blocking IPv4 socket like Udp.open, but bound to 127.0.0.1 alone: programs on the same machine reach it, and nothing on the network can. Use it for a port only local tools should talk to, such as a development link. Returns the handle, or 0 when it could not.

program Demo {
  entry {
    let s = Udp.open_local(port: 0)
    print(s > 0)
  }
}