summary refs log tree commit diff stats
path: root/examples/unix_socket/server.nim
blob: e798bbb48edd6fe357c6e09f366d6b468cf39010 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()