Merge branch 'unix-sockets' of https://github.com/girvo/Nim into girvo-unix-sockets

This commit is contained in:
Dominik Picheta 2016-05-30 09:38:37 +01:00
commit a484e3f8c2
5 changed files with 60 additions and 3 deletions

View file

@ -0,0 +1,6 @@
import net
let sock = newSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP)
sock.connectUnix("sock")
sock.send("hello\n")

View file

@ -0,0 +1,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()