test/testClient.lua

Wed, 05 Sep 2007 23:05:05 -0400

author
Thomas Harning Jr <harningt@gmail.com>
date
Wed, 05 Sep 2007 23:05:05 -0400
changeset 22
48a109847dce
parent 17
1a093a31059d
permissions
-rw-r--r--

Completely refactored event_callback creation out into event_callback.

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