lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Ok, now that issue #6 is fixed (upstream) I feel a bit more confident
when playing around with it.

Here's how I wrote the echo client counterpart to tcp_echosrv.lua

-- Begin code
local luv = require('luv')
local client = luv.net.tcp()
client:connect('127.0.0.1', 8080)

while true do
	local msg = luv.stdin:read()
	client:write(msg)
	print(client:read())
end

client:close()
-- End code

I guess how would you write this if you were doing it. It seems simple
enough that there wouldn't be any huge changes. Anyways, from the
little I've looked at it, Luv looks like it'll be fun to play with.