udp server example
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user