diff options
-rw-r--r-- | test/unixclnt.lua | 8 | ||||
-rw-r--r-- | test/unixsrvr.lua | 9 | ||||
-rw-r--r-- | test/unixtest.lua | 10 |
3 files changed, 17 insertions, 10 deletions
diff --git a/test/unixclnt.lua b/test/unixclnt.lua new file mode 100644 index 0000000..5171535 --- /dev/null +++ b/test/unixclnt.lua | |||
@@ -0,0 +1,8 @@ | |||
1 | socket = require"socket" | ||
2 | socket.unix = require"socket.unix" | ||
3 | c = assert(socket.unix()) | ||
4 | assert(c:connect("/tmp/foo")) | ||
5 | while 1 do | ||
6 | local l = io.read() | ||
7 | assert(c:send(l .. "\n")) | ||
8 | end | ||
diff --git a/test/unixsrvr.lua b/test/unixsrvr.lua new file mode 100644 index 0000000..81b9c99 --- /dev/null +++ b/test/unixsrvr.lua | |||
@@ -0,0 +1,9 @@ | |||
1 | socket = require"socket" | ||
2 | socket.unix = require"socket.unix" | ||
3 | u = assert(socket.unix()) | ||
4 | assert(u:bind("/tmp/foo")) | ||
5 | assert(u:listen()) | ||
6 | c = assert(u:accept()) | ||
7 | while 1 do | ||
8 | print(assert(c:receive())) | ||
9 | end | ||
diff --git a/test/unixtest.lua b/test/unixtest.lua deleted file mode 100644 index e70b356..0000000 --- a/test/unixtest.lua +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | socket = require("socket") | ||
2 | f = loadlib("etc-1.0.dylib", "unix_open") | ||
3 | f(socket) | ||
4 | u = socket.unix() | ||
5 | print(u:bind("/tmp/luasocket")) | ||
6 | print(u:listen()) | ||
7 | c = u:accept() | ||
8 | while 1 do | ||
9 | print(assert(c:receive())) | ||
10 | end | ||