Lua bindings to anet library
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits behind armatys:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.markdown
premake4.lua

README.markdown

LuaAnet - Lua bindings to anet library (from redis project)

Compilation

Use premake to generate appropriate build files. E.g run premake4 gmake to generate a Makefile. Then execute make config=release32 or make config=release64 to compile.

Usage:

require "anet"

local fd, err = anet.tcpserver(8080, "127.0.0.1")

while true do
	local clientfd, ip, port = anet.accept(fd, true, true)
	local n, msg = anet.read(clientfd, 4096)
	print("Read " .. n .. " bytes")
	
	if n > 0 then
		io.write(msg)
	elseif n < 0 then
		-- print error message
		print(msg)
		break
	elseif n == 0 then
		-- client closed connection
		anet.close(clientfd)
	end
end