test/testClient.lua

Sat, 15 Jan 2011 20:21:54 -0500

author
Thomas Harning Jr <harningt@gmail.com>
date
Sat, 15 Jan 2011 20:21:54 -0500
changeset 100
41a6f9a64b9e
parent 17
1a093a31059d
permissions
-rw-r--r--

base: noted in CHANGELOG pending 0.3.0 release

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