Files
Nim/examples/unix_socket/server.nim
2015-10-28 20:01:48 +01:00

15 lines
267 B
Nim

import net
let sock = newSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP)
sock.bindUnix("sock")
sock.listen()
while true:
var client = new(Socket)
sock.accept(client)
var output = ""
output.setLen 32
client.readLine(output)
echo "got ", output
client.close()