test/testClient.lua

changeset 13
3e2ea1e7b2e8
child 17
1a093a31059d
equal deleted inserted replaced
12:a9b590350c03 13:3e2ea1e7b2e8
1 require"luaevent"
2 require"socket"
3 local oldPrint = print
4 print = function(...)
5 oldPrint("CLT", ...)
6 end
7
8 local function func()
9 print("ACTIVATED")
10 local sock = socket.tcp()
11 --sock:
12 sock = luaevent.wrap(sock)
13 print(assert(sock:connect("localhost", 20000)))
14 for i = 1, 100 do assert(sock:send("Greet me ")) assert(sock:receive(10)) collectgarbage() end
15 end
16
17 luaevent.addthread(func)
18
19 luaevent.loop()

mercurial