test/testClient.lua

Mon, 16 Jan 2012 01:53:45 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 16 Jan 2012 01:53:45 +0000
changeset 107
f937d449075d
parent 17
1a093a31059d
permissions
-rw-r--r--

Merge with upstream

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()

mercurial