Udp.open_local(port): a socket bound to 127.0.0.1 alone (udp.ll, udp_win.ll), for a port only this machine's tools reach - a dev link - where Udp.open binds every interface
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7f476513cd
commit
f66b912cf4
6 changed files with 71 additions and 2 deletions
23
docs/language/udp/udp-open_local.md
Normal file
23
docs/language/udp/udp-open_local.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
id: udp-open_local
|
||||
name: Udp.open_local
|
||||
category: udp
|
||||
kind: namespace-method
|
||||
tokens: Udp.open_local
|
||||
sig: Udp.open_local(port) -> int
|
||||
tip: Open a socket only this machine can reach.
|
||||
order: 0
|
||||
ns: Udp
|
||||
member: open_local
|
||||
---
|
||||
|
||||
Opens a non-blocking IPv4 socket like <a href="udp-open.html"><code>Udp.open</code></a>, but bound to <code>127.0.0.1</code> 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 <code>0</code> when it could not.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
entry {
|
||||
let s = Udp.open_local(port: 0)
|
||||
print(s > 0)
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue