test/testClient.lua

Fri, 31 Aug 2007 09:34:09 -0400

author
Thomas Harning Jr <harningt@gmail.com>
date
Fri, 31 Aug 2007 09:34:09 -0400
changeset 13
3e2ea1e7b2e8
child 17
1a093a31059d
permissions
-rw-r--r--

Reformed project layout from 'luaevent/*' -> '*'

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
end

luaevent.addthread(func)

luaevent.loop()

mercurial