mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
Added simple unix tests.
This commit is contained in:
parent
be2e467929
commit
37f266ceea
8
test/unixclnt.lua
Normal file
8
test/unixclnt.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
socket = require"socket"
|
||||||
|
socket.unix = require"socket.unix"
|
||||||
|
c = assert(socket.unix())
|
||||||
|
assert(c:connect("/tmp/foo"))
|
||||||
|
while 1 do
|
||||||
|
local l = io.read()
|
||||||
|
assert(c:send(l .. "\n"))
|
||||||
|
end
|
9
test/unixsrvr.lua
Normal file
9
test/unixsrvr.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
socket = require"socket"
|
||||||
|
socket.unix = require"socket.unix"
|
||||||
|
u = assert(socket.unix())
|
||||||
|
assert(u:bind("/tmp/foo"))
|
||||||
|
assert(u:listen())
|
||||||
|
c = assert(u:accept())
|
||||||
|
while 1 do
|
||||||
|
print(assert(c:receive()))
|
||||||
|
end
|
@ -1,10 +0,0 @@
|
|||||||
socket = require("socket")
|
|
||||||
f = loadlib("etc-1.0.dylib", "unix_open")
|
|
||||||
f(socket)
|
|
||||||
u = socket.unix()
|
|
||||||
print(u:bind("/tmp/luasocket"))
|
|
||||||
print(u:listen())
|
|
||||||
c = u:accept()
|
|
||||||
while 1 do
|
|
||||||
print(assert(c:receive()))
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user