udp server example

This commit is contained in:
2026-03-12 17:50:01 +01:00
parent f2a7179b03
commit 100b752eee
5 changed files with 160 additions and 134 deletions

View File

@@ -1,7 +1,9 @@
func main[] : i64
let host: i64 = net.pack_addr(127, 0, 0, 1)
let s: i64 = net.listen(host, 8000)
let s: i64 = net.listen(net.pack_addr(127, 0, 0, 1), 8000)
if s < 0
panic("failed to bind a socket")
io.println("Listening on port 8000...")
let resp: str = mem.alloc(60000)
while true
let conn: i64 = net.accept(s)