headers: updates Lua 5.2 workaround to allow 5.3 version
[luaevent.git] / test / testClient.lua
blobfcf3b0b4cd5906ef3fa8e4ad1ed2d9ab96056709
1 local luaevent = require("luaevent")
2 local socket = require("socket")
4 local oldPrint = print
5 print = function(...)
6 oldPrint("CLT", ...)
7 end
9 local function func()
10 print("ACTIVATED")
11 local sock = socket.tcp()
12 --sock:
13 sock = luaevent.wrap(sock)
14 print(assert(sock:connect("localhost", 20000)))
15 for i = 1, 100 do assert(sock:send("Greet me ")) assert(sock:receive(10)) collectgarbage() end
16 print("COMPLETE")
17 end
19 luaevent.addthread(func)
21 luaevent.loop()