1 -- Tests Copas with a simple Echo server
3 -- Run the test file and the connect to the server by telnet on the used port
4 -- to stop the test just send the command "quit"
13 local function echoHandler(skt
)
15 local data
,ret
= luaevent
.receive(skt
, 10)
16 --print("GOT: ", data, ret)
17 if data
== "quit" or ret
== 'closed' then
20 luaevent
.send(skt
, data
)
26 local server
= assert(socket
.bind("localhost", 20000))
28 local coro
= coroutine
.create
29 coroutine
.create
= function(...)
33 luaevent
.addserver(server
, echoHandler
)