16 lines
417 B
Plaintext
16 lines
417 B
Plaintext
func main[] : i64
|
|
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)
|
|
if conn < 0
|
|
continue
|
|
|
|
let n: i64 = net.read(conn, resp, 60000)
|
|
net.send(conn, resp, n)
|
|
net.close(conn)
|