aboutsummaryrefslogtreecommitdiffstats
path: root/test/testClient.lua
blob: 871207ac5aa0ebc64fbf3f90941c86919ad2c42d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require"luaevent"
require"socket"
local oldPrint = print
print = function(...)
	oldPrint("CLT", ...)
end

local function func()
	print("ACTIVATED")
	local sock = socket.tcp()
	--sock:
	sock = luaevent.wrap(sock)
	print(assert(sock:connect("localhost", 20000)))
	for i = 1, 100 do assert(sock:send("Greet me  ")) assert(sock:receive(10)) collectgarbage() end
	print("COMPLETE")
end

luaevent.addthread(func)

luaevent.loop()